coverity: #1425886

free allocated memory Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 69e930b2
...@@ -1443,7 +1443,6 @@ int lxc_attach_run_shell(void* payload) ...@@ -1443,7 +1443,6 @@ int lxc_attach_run_shell(void* payload)
user_shell = lxc_attach_getpwshell(uid); user_shell = lxc_attach_getpwshell(uid);
else else
user_shell = passwd->pw_shell; user_shell = passwd->pw_shell;
if (user_shell) if (user_shell)
execlp(user_shell, user_shell, (char *)NULL); execlp(user_shell, user_shell, (char *)NULL);
...@@ -1451,6 +1450,8 @@ int lxc_attach_run_shell(void* payload) ...@@ -1451,6 +1450,8 @@ int lxc_attach_run_shell(void* payload)
* on /bin/sh as a default shell. * on /bin/sh as a default shell.
*/ */
execlp("/bin/sh", "/bin/sh", (char *)NULL); execlp("/bin/sh", "/bin/sh", (char *)NULL);
SYSERROR("Failed to exec shell."); SYSERROR("Failed to execute shell");
if (!passwd)
free(user_shell);
return -1; return -1;
} }
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