coverity: #1425921

free allocated memory Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent cb66857d
...@@ -599,6 +599,7 @@ static char *lxc_attach_getpwshell(uid_t uid) ...@@ -599,6 +599,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;
} }
...@@ -607,14 +608,20 @@ static char *lxc_attach_getpwshell(uid_t uid) ...@@ -607,14 +608,20 @@ static char *lxc_attach_getpwshell(uid_t uid)
* don't. * 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