]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/address: avoid cppcheck false positive
authorVictor Julien <vjulien@oisf.net>
Tue, 20 Feb 2024 15:06:08 +0000 (16:06 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 22 Feb 2024 09:02:48 +0000 (10:02 +0100)
src/detect-engine-address.c:1386:5: error: Memory leak: map.string [memleak]
    return true;
    ^

Seems cppcheck looses track of the pointer after the unnecessary cast to
void.

Bug: #6527.

src/detect-engine-address.c

index c30ebd6878dcad55101671b934c8ce76ccb693b4..59ee5ed7975aae34072b10acd34ada51f1619c24 100644 (file)
@@ -1377,7 +1377,7 @@ static bool DetectAddressMapAdd(DetectEngineCtx *de_ctx, const char *string,
     map->address = address;
     map->contains_negation = contains_negation;
 
-    if (HashListTableAdd(de_ctx->address_table, (void *)map, 0) != 0) {
+    if (HashListTableAdd(de_ctx->address_table, map, 0) != 0) {
         SCFree(map->string);
         SCFree(map);
         return false;