From ab421978f0b6190bb9d7137c8dffde907cf72bd6 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 2 Jul 2012 14:04:30 +0200 Subject: [PATCH] Free all sig match structs when freeing a signature. --- src/detect-parse.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) 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);