From: Victor Julien Date: Mon, 2 Jul 2012 12:04:30 +0000 (+0200) Subject: Free all sig match structs when freeing a signature. X-Git-Tag: suricata-1.3~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab421978f0b6190bb9d7137c8dffde907cf72bd6;p=thirdparty%2Fsuricata.git Free all sig match structs when freeing a signature. --- diff --git a/src/detect-parse.c b/src/detect-parse.c index c79f8c8872..c62ec86976 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -835,39 +835,14 @@ void SigFree(Signature *s) { if (s->CidrSrc != NULL) IPOnlyCIDRListFree(s->CidrSrc); - SigMatch *sm = s->sm_lists[DETECT_SM_LIST_MATCH], *nsm; - while (sm != NULL) { - nsm = sm->next; - SigMatchFree(sm); - sm = nsm; - } - - sm = s->sm_lists[DETECT_SM_LIST_PMATCH]; - while (sm != NULL) { - nsm = sm->next; - SigMatchFree(sm); - sm = nsm; - } - - sm = s->sm_lists[DETECT_SM_LIST_UMATCH]; - while (sm != NULL) { - nsm = sm->next; - SigMatchFree(sm); - sm = nsm; - } - - sm = s->sm_lists[DETECT_SM_LIST_AMATCH]; - while (sm != NULL) { - nsm = sm->next; - SigMatchFree(sm); - sm = nsm; - } - - sm = s->sm_lists[DETECT_SM_LIST_TMATCH]; - while (sm != NULL) { - nsm = sm->next; - SigMatchFree(sm); - sm = nsm; + int i; + for (i = 0; i < DETECT_SM_LIST_MAX; i++) { + SigMatch *sm = s->sm_lists[i], *nsm; + while (sm != NULL) { + nsm = sm->next; + SigMatchFree(sm); + sm = nsm; + } } DetectAddressHeadCleanup(&s->src);