]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect: fix memory leak in error handling
authorVictor Julien <vjulien@oisf.net>
Tue, 20 Feb 2024 15:06:57 +0000 (16:06 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 22 Feb 2024 09:02:48 +0000 (10:02 +0100)
Pointed out by cppcheck:

src/detect-parse.c:1544:9: error: Memory leak: sig.init_data [memleak]
        SCFree(sig);
        ^

Bug: #6527.

src/detect-parse.c

index c297caecbcf9673bf9ac29c55c4a7e01a4b51856..243dbf9befa323b47b7f2940092ebef23af407c9 100644 (file)
@@ -1541,6 +1541,7 @@ Signature *SigAlloc (void)
 
     sig->init_data->buffers = SCCalloc(8, sizeof(SignatureInitDataBuffer));
     if (sig->init_data->buffers == NULL) {
+        SCFree(sig->init_data);
         SCFree(sig);
         return NULL;
     }