]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Revert "nl: fix memory leak"
authorStéphane Graber <stgraber@ubuntu.com>
Thu, 18 Jun 2020 14:22:02 +0000 (10:22 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 18 Jun 2020 14:22:44 +0000 (10:22 -0400)
This reverts commit 9d05339487f4e9c4e7f700f963c161a4d9977ae4.

This causes a double-free as the variable is already using __do_free.

Closes #3452

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/nl.c

index 048a5a53f1c5eb6c11bd0b6e939749e2572af34c..dd94c09c886b1d5c81e728e28591ea8844971dee 100644 (file)
@@ -106,10 +106,8 @@ struct nlmsg *nlmsg_alloc(size_t size)
                return ret_set_errno(NULL, ENOMEM);
 
        nlmsg->nlmsghdr = malloc(len);
-       if (!nlmsg->nlmsghdr) {
-               free(nlmsg);
+       if (!nlmsg->nlmsghdr)
                return ret_set_errno(NULL, ENOMEM);
-       }
 
        memset(nlmsg->nlmsghdr, 0, len);
        nlmsg->cap = len;