[lxc-devel] [lxc/master] nl: fix memory leak
gaurav1086 on Github
lxc-bot at linuxcontainers.org
Sat Jun 13 18:07:41 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 399 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200613/d7615bf5/attachment.bin>
-------------- next part --------------
From 9d05339487f4e9c4e7f700f963c161a4d9977ae4 Mon Sep 17 00:00:00 2001
From: Gaurav Singh <gaurav1086 at gmail.com>
Date: Sat, 13 Jun 2020 14:06:04 -0400
Subject: [PATCH] nl: fix memory leak
Signed-off-by: Gaurav Singh <gaurav1086 at gmail.com>
---
src/lxc/nl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lxc/nl.c b/src/lxc/nl.c
index dd94c09c88..048a5a53f1 100644
--- a/src/lxc/nl.c
+++ b/src/lxc/nl.c
@@ -106,8 +106,10 @@ struct nlmsg *nlmsg_alloc(size_t size)
return ret_set_errno(NULL, ENOMEM);
nlmsg->nlmsghdr = malloc(len);
- if (!nlmsg->nlmsghdr)
+ if (!nlmsg->nlmsghdr) {
+ free(nlmsg);
return ret_set_errno(NULL, ENOMEM);
+ }
memset(nlmsg->nlmsghdr, 0, len);
nlmsg->cap = len;
More information about the lxc-devel
mailing list