]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Fix a leak in probing parsers. We were freeing just the head of the list, 567/head
authorAnoop Saldanha <anoopsaldanha@gmail.com>
Sun, 29 Sep 2013 16:45:46 +0000 (22:15 +0530)
committerAnoop Saldanha <anoopsaldanha@gmail.com>
Mon, 30 Sep 2013 02:51:32 +0000 (08:21 +0530)
instead of all the members.

src/app-layer-detect-proto.c

index 76263961ccf363551a6cfac34a80f62a25869254..5f10310e40f2f2d98190dc90bec6a41545e92542 100644 (file)
@@ -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;