From: Christian Brauner Date: Sat, 9 Dec 2017 17:44:41 +0000 (+0100) Subject: coverity: #1425886 X-Git-Tag: lxc-3.0.0.beta1~113^2~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=edeb1836bac992f1a6c19a0810fc8274c3de542f;p=thirdparty%2Flxc.git coverity: #1425886 free allocated memory Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index fa6c3cf29..c83a4455e 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -1504,7 +1504,6 @@ int lxc_attach_run_shell(void* payload) user_shell = lxc_attach_getpwshell(uid); else user_shell = passwd->pw_shell; - if (user_shell) execlp(user_shell, user_shell, (char *)NULL); @@ -1512,6 +1511,8 @@ int lxc_attach_run_shell(void* payload) * on /bin/sh as a default shell. */ execlp("/bin/sh", "/bin/sh", (char *)NULL); - SYSERROR("Failed to exec shell."); + SYSERROR("Failed to execute shell"); + if (!passwd) + free(user_shell); return -1; }