From: Stéphane Graber Date: Thu, 18 Jun 2020 14:22:02 +0000 (-0400) Subject: Revert "nl: fix memory leak" X-Git-Tag: lxc-5.0.0~413 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3d88831c53f4b8f334bc45e689d7820dbcf176bf;p=thirdparty%2Flxc.git Revert "nl: fix memory leak" 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 --- diff --git a/src/lxc/nl.c b/src/lxc/nl.c index 048a5a53f..dd94c09c8 100644 --- a/src/lxc/nl.c +++ b/src/lxc/nl.c @@ -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;