[lxc-devel] [lxc/master] c/r: free valid_opts if necessary

tych0 on Github lxc-bot at linuxcontainers.org
Tue Sep 13 22:43:51 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 451 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160913/1752f442/attachment.bin>
-------------- next part --------------
From f686506dfb2a7fe61b4ff1b3192bef6db19be2ac Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Tue, 13 Sep 2016 16:42:20 -0600
Subject: [PATCH] c/r: free valid_opts if necessary

2cb80427bc468f7647309c3eca66cfc9afa85b61 introduced a malloc without a
matching free.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/lxccontainer.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index c02e587..a1c94a1 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -4007,6 +4007,9 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
 		ret = -EINVAL;
 	}
 
+	if (size < sizeof(*opts))
+		free(valid_opts);
+
 	return ret;
 }
 


More information about the lxc-devel mailing list