From 4e98a3e530f701240a050acffe67fd8810400a32 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 10 Dec 2014 10:54:22 +0100 Subject: [PATCH] AC: fix memory leak --- src/util-mpm-ac.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util-mpm-ac.c b/src/util-mpm-ac.c index 6cf05c1ffc..c8f6be77a2 100644 --- a/src/util-mpm-ac.c +++ b/src/util-mpm-ac.c @@ -218,6 +218,10 @@ static inline void SCACFreePattern(MpmCtx *mpm_ctx, SCACPattern *p) mpm_ctx->memory_size -= p->len; } + if (p != NULL && p->sids != NULL) { + SCFree(p->sids); + } + if (p != NULL) { SCFree(p); mpm_ctx->memory_cnt--; @@ -1089,6 +1093,9 @@ int SCACPreparePatterns(MpmCtx *mpm_ctx) //SCLogInfo("ctx->parray[i]->sids_size %u", ctx->parray[i]->sids_size); ctx->pid_pat_list[ctx->parray[i]->id].sids_size = ctx->parray[i]->sids_size; ctx->pid_pat_list[ctx->parray[i]->id].sids = ctx->parray[i]->sids; + + ctx->parray[i]->sids_size = 0; + ctx->parray[i]->sids = NULL; } /* prepare the state table required by AC */ -- 2.47.2