]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables: Coverity: RESOURCE_LEAK
authorJiri Popelka <jpopelka@redhat.com>
Fri, 10 Jun 2011 13:26:02 +0000 (15:26 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Wed, 22 Jun 2011 16:08:30 +0000 (18:08 +0200)
xtables.c:320: alloc_fn: Calling allocation function "get_modprobe".
xtables.c:294: alloc_fn: Storage is returned from allocation function "malloc".
xtables.c:294: var_assign: Assigning: "ret" = "malloc(1024UL)".
xtables.c:304: return_alloc: Returning allocated memory "ret".
xtables.c:320: var_assign: Assigning: "buf" =  storage returned from "get_modprobe()".
xtables.c:323: var_assign: Assigning: "modprobe" = "buf".
xtables.c:348: leaked_storage: Variable "buf" going out of scope
               leaks the storage it points to.
xtables.c:348: leaked_storage: Returning without freeing "modprobe"
               leaks the storage that it points to.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
iptables/xtables.c

index db6d079f1220620f405cac53da8bb6905bb71fbe..00c7c0665cdf7cd14db24b518c18265a28a00330 100644 (file)
@@ -362,6 +362,7 @@ int xtables_insmod(const char *modname, const char *modprobe, bool quiet)
                /* not usually reached */
                exit(1);
        case -1:
+               free(buf);
                return -1;
 
        default: /* parent */