]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
fix free() of args to startl
authorDwight Engen <dwight.engen@oracle.com>
Tue, 29 Oct 2013 18:38:00 +0000 (14:38 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 29 Oct 2013 18:55:05 +0000 (14:55 -0400)
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 <dwight.engen@oracle.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxccontainer.c

index f2f7240fc81cee5467345c5a14a76397de6e04c4..9d537a6e3bd56605d851c09d69ce44b96ee9d1b7 100644 (file)
@@ -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);
        }