asn1: fix memory leak

As reported in issue #1395, fix 2 memory leaks when destroying
asn.1 decode contexts.
pull/1842/head
Jason Ish 11 years ago committed by Victor Julien
parent 96ed8d90ee
commit 18760e222a

@ -373,13 +373,15 @@ void SCAsn1CtxDestroy(Asn1Ctx *ac)
if (ac == NULL) if (ac == NULL)
return; return;
uint16_t i = 0; for (uint16_t i = 0; i < asn1_max_frames_config; i++) {
for (; i < ac->cur_frame; i++) {
Asn1Node *node = ASN1CTX_GET_NODE(ac, i); Asn1Node *node = ASN1CTX_GET_NODE(ac, i);
if (node != NULL) { if (node == NULL) {
SCFree(node); break;
} }
SCFree(node);
} }
SCFree(ac->asn1_stack);
SCFree(ac); SCFree(ac);
} }

Loading…
Cancel
Save