diff options
| author | liuxueli <[email protected]> | 2022-02-16 18:41:10 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2022-02-16 18:41:10 +0800 |
| commit | 6d9ed75b88c1b65e036a26b2c430e49ae4fc4c1c (patch) | |
| tree | 0bc9a44ae53bc11c4ee536b0ab57f44b74f83b08 /src | |
| parent | ed9c9c3042d9b0d1eeacdaf325b37fbe47762f0a (diff) | |
TSG-9633: 申请/释放内存方式不一致导致sapp重启v2.0.8
Diffstat (limited to 'src')
| -rw-r--r-- | src/SSL_Analyze.c | 22 |
1 files changed, 15 insertions, 7 deletions
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; } |
