From: Christian Brauner Date: Wed, 15 Apr 2020 12:09:11 +0000 (+0200) Subject: rexec: free argv array on failure X-Git-Tag: lxc-5.0.0~451^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3381%2Fhead;p=thirdparty%2Flxc.git rexec: free argv array on failure Fixes: Coverity 1461736. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index 3bb43a215..cd76efb3c 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -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; }