From: Anoop Saldanha Date: Sun, 29 Sep 2013 16:45:46 +0000 (+0530) Subject: Fix a leak in probing parsers. We were freeing just the head of the list, X-Git-Tag: suricata-2.0beta2~272 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F567%2Fhead;p=thirdparty%2Fsuricata.git Fix a leak in probing parsers. We were freeing just the head of the list, instead of all the members. --- diff --git a/src/app-layer-detect-proto.c b/src/app-layer-detect-proto.c index 76263961cc..5f10310e40 100644 --- a/src/app-layer-detect-proto.c +++ b/src/app-layer-detect-proto.c @@ -116,9 +116,9 @@ static void AlpProtoAddSignature(AlpProtoDetectCtx *ctx, DetectContentData *co, ctx->sigs++; } -#ifdef UNITTESTS /** \brief free a AlpProtoSignature, recursively free any next sig */ -static void AlpProtoFreeSignature(AlpProtoSignature *s) { +static void AlpProtoFreeSignature(AlpProtoSignature *s) +{ if (s == NULL) return; @@ -132,7 +132,6 @@ static void AlpProtoFreeSignature(AlpProtoSignature *s) { AlpProtoFreeSignature(next_s); } -#endif /** * \brief Match a AlpProtoSignature against a buffer @@ -254,6 +253,7 @@ void AlpProtoDestroy() { mpm_table[alp_proto_ctx.toserver.mpm_ctx.mpm_type].DestroyCtx(&alp_proto_ctx.toserver.mpm_ctx); mpm_table[alp_proto_ctx.toclient.mpm_ctx.mpm_type].DestroyCtx(&alp_proto_ctx.toclient.mpm_ctx); MpmPatternIdTableFreeHash(alp_proto_ctx.mpm_pattern_id_store); + AlpProtoFreeSignature(alp_proto_ctx.head); AppLayerFreeProbingParsers(alp_proto_ctx.probing_parsers); alp_proto_ctx.probing_parsers = NULL;