From: Victor Julien Date: Wed, 8 Jan 2014 17:10:16 +0000 (+0100) Subject: Fix AppLayerProtoDetectPMFreeSignature related valgrind errors X-Git-Tag: suricata-2.0rc1~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67053e6ed000b6c9d8cbebd8f6fee8f4fb1824c0;p=thirdparty%2Fsuricata.git Fix AppLayerProtoDetectPMFreeSignature related valgrind errors --- diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index e9e2c637c3..e89ecda0e1 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -1120,7 +1120,10 @@ static int AppLayerProtoDetectPMPrepareMpm(AppLayerProtoDetectPMCtx *ctx) static void AppLayerProtoDetectPMFreeSignature(AppLayerProtoDetectPMSignature *sig) { SCEnter(); - DetectContentFree(sig->cd); + if (sig == NULL) + SCReturn; + if (sig->cd) + DetectContentFree(sig->cd); SCFree(sig); SCReturn; } @@ -1444,8 +1447,8 @@ int AppLayerProtoDetectDeSetup(void) mpm_table[pm_ctx->mpm_ctx.mpm_type].DestroyCtx(pm_ctx->mpm_ctx.ctx); for (id = 0; id < pm_ctx->max_pat_id; id++) { sig = pm_ctx->map[id]; - next_sig = sig->next; while (sig != NULL) { + next_sig = sig->next; AppLayerProtoDetectPMFreeSignature(sig); sig = next_sig; }