coverity: #1425921

free allocated memory Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 241f7d14
...@@ -557,6 +557,7 @@ static char *lxc_attach_getpwshell(uid_t uid) ...@@ -557,6 +557,7 @@ static char *lxc_attach_getpwshell(uid_t uid)
if (waitpid(pid, &status, 0) < 0) { if (waitpid(pid, &status, 0) < 0) {
if (errno == EINTR) if (errno == EINTR)
goto again; goto again;
free(result);
return NULL; return NULL;
} }
...@@ -565,14 +566,20 @@ static char *lxc_attach_getpwshell(uid_t uid) ...@@ -565,14 +566,20 @@ static char *lxc_attach_getpwshell(uid_t uid)
* we assume we don't * we assume we don't
*/ */
if (!WIFEXITED(status)) if (!WIFEXITED(status)) {
free(result);
return NULL; return NULL;
}
if (WEXITSTATUS(status) != 0) if (WEXITSTATUS(status) != 0) {
free(result);
return NULL; return NULL;
}
if (!found) if (!found) {
free(result);
return NULL; return NULL;
}
return result; return result;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment