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); }