From 6d9ed75b88c1b65e036a26b2c430e49ae4fc4c1c Mon Sep 17 00:00:00 2001 From: liuxueli Date: Wed, 16 Feb 2022 18:41:10 +0800 Subject: TSG-9633: 申请/释放内存方式不一致导致sapp重启 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/SSL_Analyze.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/SSL_Analyze.c b/src/SSL_Analyze.c index 2833922..c8a8881 100644 --- a/src/SSL_Analyze.c +++ b/src/SSL_Analyze.c @@ -170,21 +170,29 @@ int ssl_add_proto_tag(int projetc_id, struct streaminfo *a_stream, const char* v struct ssl_proto_tag_t* proto_tag = (struct ssl_proto_tag_t*)project_req_get_struct(a_stream,projetc_id); if(proto_tag == NULL) { - proto_tag = (struct ssl_proto_tag_t *)calloc(sizeof(struct ssl_proto_tag_t), 1); + proto_tag = (struct ssl_proto_tag_t *)dictator_malloc(a_stream->threadnum, sizeof(struct ssl_proto_tag_t)); + memcpy(proto_tag->buf, value, len); + proto_tag->buf[len]='\0'; + if(0 != project_req_add_struct(a_stream, projetc_id, proto_tag)) { - free(proto_tag); + dictator_free(a_stream->threadnum, proto_tag); + proto_tag=NULL; return -1; } - } - memcpy(proto_tag->buf, value, len); - proto_tag->buf[len]='\0'; + } + return 0; } void ssl_proto_tag_free(int thread_seq, void *value) -{ - free(value); +{ + if(value!=NULL) + { + dictator_free(thread_seq, value); + value=NULL; + } + return; } -- cgit v1.2.3