Skip to content

Commit

Permalink
rexec: free argv array on failure
Browse files Browse the repository at this point in the history
Fixes: Coverity 1461736.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Apr 15, 2020
1 parent a990911 commit 0212dc6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lxc/rexec.c
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 0212dc6

Please sign in to comment.