The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3449
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Gaurav Singh <gaurav1...@gmail.com> Fix memory leak: Free nlmsg before returning
From 9d05339487f4e9c4e7f700f963c161a4d9977ae4 Mon Sep 17 00:00:00 2001 From: Gaurav Singh <gaurav1...@gmail.com> Date: Sat, 13 Jun 2020 14:06:04 -0400 Subject: [PATCH] nl: fix memory leak Signed-off-by: Gaurav Singh <gaurav1...@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;
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel