Bug #1359
closedmemory leak
Description
fix up the memory leak in ans1 match
Files
WX Updated by wei xuan over 11 years ago
there are two memory leak in SCAsn1CtxDestroy
the first:
the malloc memory in SCAsn1CtxNew in util-decode-asn1.c
ac->asn1_stack = SCMalloc(sizeof(Asn1Node *) * asn1_max_frames_config);
but when destory in SCAsn1CtxDestroy in util-decode-asn1.c, only free acSCFree(ac);
so the memory of asn1_stack will leak
the second:
in SCAsn1Decode of SCAsn1Decodeif (SCAsn1CtxNewFrame(ac, node_id) == NULL)break;
ac->cur_frame = node_id;
this code in while, for example, if the while run twice, malloc two node, the cur_frame is only 1
but SCAsn1CtxDestroy in util-decode-asn1.c for (; i < ac->cur_frame; i++) {
Asn1Node *node = ASN1CTX_GET_NODE(ac, i);
if (node != NULL) {
SCFree(node);
}
}
when we free the node in SCAsn1Decode , the last node we don't free, so memory leak here.
repair them,
the frist memory leak, should addSCFree(ac->asn1_stack)
the second memory leak, should modified i < ac->cur_frame to i <= ac->cur_frame
VJ Updated by Victor Julien almost 11 years ago
- Status changed from New to Assigned
- Assignee changed from wei xuan to Jason Ish
- Priority changed from High to Normal
- Target version set to 3.0RC1
Jason can you check this in master and 2.0.8? If stable is affected we'll need a separate ticket for that.
VJ Updated by Victor Julien over 10 years ago
- Target version changed from 3.0RC1 to 70
VJ Updated by Victor Julien about 10 years ago
- Priority changed from Normal to High
JI Updated by Jason Ish about 10 years ago
- Status changed from Assigned to Resolved
VJ Updated by Victor Julien about 10 years ago
- Status changed from Resolved to Closed
- Target version changed from 70 to 3.0.1RC1