From 0242fad7703c7297b5d365464bf655d579230c98 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 21 Aug 2009 10:37:56 +0200 Subject: [PATCH] Fix error in freeing the ctx of a SigMatch. --- src/detect-parse.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 40a1068e8e..c5c8a15e51 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -58,12 +58,18 @@ SigMatch *SigMatchAlloc(void) { return sm; } +/** \brief free a SigMatch + * \param sm SigMatch to free. + */ void SigMatchFree(SigMatch *sm) { if (sm == NULL) return; - if (sigmatch_table[sm->type].Free != NULL) { - sigmatch_table[sm->type].Free(sm); + /** free the ctx, for that we call the Free func */ + if (sm->ctx != NULL) { + if (sigmatch_table[sm->type].Free != NULL) { + sigmatch_table[sm->type].Free(sm->ctx); + } } free(sm); }