diff options
| author | liuxueli <[email protected]> | 2024-03-07 14:05:28 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2024-03-07 14:05:28 +0800 |
| commit | 1ab2559887cce2447491aa17603306d92d169cd4 (patch) | |
| tree | 7e09a3f1fecb8298dc00506de634a7a334ded6bd | |
| parent | 33a2bc5b39ca43650809124c9eca62b3b31c93c5 (diff) | |
TSG-19817: Bugfix memory leakv2.0.11
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | src/quic_process.cpp | 15 |
2 files changed, 13 insertions, 4 deletions
@@ -6,7 +6,7 @@ Debug .project .settings/ SI -build/ +build*/ src/inc src/lib64 cmake-build-*/ diff --git a/src/quic_process.cpp b/src/quic_process.cpp index 4b677c6..076001e 100644 --- a/src/quic_process.cpp +++ b/src/quic_process.cpp @@ -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(*out!=NULL) + { + dictator_free(thread_seq, *out); + *out=NULL; + } + (*out)=(char *)dictator_malloc(thread_seq, tag_len+1); memcpy(*out, tag_start_pos, tag_len); (*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; } - 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)); - + if(quic_info->client_hello==NULL) + { + 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) while(tag_num>pass_tag_num) |
