From 4e03ae57eddef788856415673b6d9bc0e3370795 Mon Sep 17 00:00:00 2001 From: Dwight Engen Date: Tue, 29 Oct 2013 14:38:00 -0400 Subject: [PATCH] fix free() of args to startl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity 1076328 marked this as "Use after free", which it isn't really, its actually just free()ing the wrong 2nd, 3rd, etc... pointers. Test by passing two or more args to startl, without this change you get segfault when free()ing the second pointer/arg. Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- src/lxc/lxccontainer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index f2f7240fc..9d537a6e3 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -641,9 +641,9 @@ static bool lxcapi_startl(struct lxc_container *c, int useinit, ...) out: if (inargs) { - char *arg; - for (arg = *inargs; arg; arg++) - free(arg); + char **arg; + for (arg = inargs; *arg; arg++) + free(*arg); free(inargs); } -- 2.47.2