diff --git a/lib/exec_shell.c b/lib/exec_shell.c index 49b7df5bf..18798ebe4 100644 --- a/lib/exec_shell.c +++ b/lib/exec_shell.c @@ -33,13 +33,14 @@ void __attribute__((__noreturn__)) exec_shell(void) { const char *shell = getenv("SHELL"); - char *shellc = xstrdup(shell); + char *shellc; const char *shell_basename; char *arg0; if (!shell) shell = DEFAULT_SHELL; + shellc = xstrdup(shell); shell_basename = basename(shellc); arg0 = xmalloc(strlen(shell_basename) + 2); arg0[0] = '-';