From: Christian Brauner Date: Thu, 7 Dec 2017 14:14:37 +0000 (+0100) Subject: coverity: #1425921 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d83e85cf5a3a8b40af034e2ee3434910f40d3220;p=thirdparty%2Flxc.git coverity: #1425921 free allocated memory Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index f17a16f56..4876d9ced 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -557,6 +557,7 @@ static char *lxc_attach_getpwshell(uid_t uid) if (waitpid(pid, &status, 0) < 0) { if (errno == EINTR) goto again; + free(result); return NULL; } @@ -565,14 +566,20 @@ static char *lxc_attach_getpwshell(uid_t uid) * we assume we don't */ - if (!WIFEXITED(status)) + if (!WIFEXITED(status)) { + free(result); return NULL; + } - if (WEXITSTATUS(status) != 0) + if (WEXITSTATUS(status) != 0) { + free(result); return NULL; + } - if (!found) + if (!found) { + free(result); return NULL; + } return result; } else {