]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
signature: leak fix in DetectAddressParse2
authorPhilippe Antoine <contact@catenacyber.fr>
Fri, 11 Oct 2019 08:11:56 +0000 (10:11 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 17 Oct 2019 09:29:48 +0000 (11:29 +0200)
src/detect-engine-address.c

index 682d864721700010c53480c9e451642ff24bdeb8..f6732dd64c0a592ed077fa0cc3198314e7dbdf7f 100644 (file)
@@ -911,8 +911,12 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx,
                         DetectAddressPrint(tmp_ad);
                     }
 #endif
-                    if (DetectAddressMergeNot(&tmp_gh, &tmp_ghn) < 0)
+                    if (DetectAddressMergeNot(&tmp_gh, &tmp_ghn) < 0) {
+                        DetectAddressHeadCleanup(&tmp_ghn);
+                        DetectAddressHeadCleanup(&tmp_gh);
                         goto error;
+                    }
+                    DetectAddressHeadCleanup(&tmp_ghn);
 
                     SCLogDebug("merged succesfully");
 
@@ -922,6 +926,7 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx,
                         tmp_ad2 = DetectAddressCopy(tmp_ad);
                         if (tmp_ad2 == NULL) {
                             SCLogDebug("DetectAddressCopy failed");
+                            DetectAddressHeadCleanup(&tmp_gh);
                             goto error;
                         }
                         DetectAddressPrint(tmp_ad2);
@@ -934,6 +939,7 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx,
                         tmp_ad2 = DetectAddressCopy(tmp_ad);
                         if (tmp_ad2 == NULL) {
                             SCLogDebug("DetectAddressCopy failed");
+                            DetectAddressHeadCleanup(&tmp_gh);
                             goto error;
                         }
                         DetectAddressPrint(tmp_ad2);
@@ -941,7 +947,6 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx,
                     }
 
                     DetectAddressHeadCleanup(&tmp_gh);
-                    DetectAddressHeadCleanup(&tmp_ghn);
                 }
                 n_set = 0;
             }