]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
rexec: free argv array on failure 3381/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 15 Apr 2020 12:09:11 +0000 (14:09 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 15 Apr 2020 12:10:31 +0000 (14:10 +0200)
Fixes: Coverity 1461736.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/rexec.c

index 3bb43a21564b377a02113cb90c0f50ec200466e0..cd76efb3c4c5f94d9f6e40bfd3356af02678662f 100644 (file)
@@ -169,13 +169,12 @@ extern char **environ;
 
 int lxc_rexec(const char *memfd_name)
 {
+       __do_free_string_list char **argv = NULL;
        int ret;
-       char **argv = NULL;
 
        ret = is_memfd();
        if (ret < 0 && ret == -ENOTRECOVERABLE) {
-               fprintf(stderr,
-                       "%s - Failed to determine whether this is a memfd\n",
+               fprintf(stderr, "%s - Failed to determine whether this is a memfd\n",
                        strerror(errno));
                return -1;
        } else if (ret > 0) {
@@ -184,8 +183,7 @@ int lxc_rexec(const char *memfd_name)
 
        ret = parse_argv(&argv);
        if (ret < 0) {
-               fprintf(stderr,
-                       "%s - Failed to parse command line parameters\n",
+               fprintf(stderr, "%s - Failed to parse command line parameters\n",
                        strerror(errno));
                return -1;
        }