From: Dwight Engen Date: Tue, 29 Oct 2013 18:38:00 +0000 (-0400) Subject: fix free() of args to startl X-Git-Tag: lxc-1.0.0.alpha3~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e03ae57eddef788856415673b6d9bc0e3370795;p=thirdparty%2Flxc.git fix free() of args to startl 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 --- 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); }