1 Commits

Author SHA1 Message Date
liuxueli
1ab2559887 TSG-19817: Bugfix memory leak 2024-03-07 14:05:28 +08:00
2 changed files with 13 additions and 4 deletions

2
.gitignore vendored
View File

@@ -6,7 +6,7 @@ Debug
.project .project
.settings/ .settings/
SI SI
build/ build*/
src/inc src/inc
src/lib64 src/lib64
cmake-build-*/ cmake-build-*/

View File

@@ -100,6 +100,12 @@ static int copy_extension_tag(const char *tag_start_pos, int tag_len, char **out
{ {
if(tag_start_pos!=NULL && tag_len>0) if(tag_start_pos!=NULL && tag_len>0)
{ {
if(*out!=NULL)
{
dictator_free(thread_seq, *out);
*out=NULL;
}
(*out)=(char *)dictator_malloc(thread_seq, tag_len+1); (*out)=(char *)dictator_malloc(thread_seq, tag_len+1);
memcpy(*out, tag_start_pos, tag_len); memcpy(*out, tag_start_pos, tag_len);
(*out)[tag_len]='\0'; (*out)[tag_len]='\0';
@@ -310,9 +316,12 @@ int parse_special_frame_stream(struct quic_info* quic_info, const char *payload,
return PARSE_RESULT_VERSION; return PARSE_RESULT_VERSION;
} }
quic_info->client_hello=(struct quic_client_hello *)dictator_malloc(thread_seq, sizeof(struct quic_client_hello)); if(quic_info->client_hello==NULL)
memset(quic_info->client_hello, 0, sizeof(struct quic_client_hello)); {
quic_info->client_hello=(struct quic_client_hello *)dictator_malloc(thread_seq, sizeof(struct quic_client_hello));
memset(quic_info->client_hello, 0, sizeof(struct quic_client_hello));
}
tag_value_start_offset=payload_offset+tag_num*4*2; // skip length of type and offset, type(offset)=szieof(int) tag_value_start_offset=payload_offset+tag_num*4*2; // skip length of type and offset, type(offset)=szieof(int)
while(tag_num>pass_tag_num) while(tag_num>pass_tag_num)