And get it right this time... don't leak if it is an empty string either.

This commit is contained in:
nicm 2013-10-11 08:03:43 +00:00
parent 17ec688ced
commit 98b81e9834
1 changed files with 6 additions and 3 deletions

View File

@ -357,9 +357,12 @@ format_get_command(struct window_pane *wp)
cmd = get_proc_name(wp->fd, wp->tty); cmd = get_proc_name(wp->fd, wp->tty);
if (cmd == NULL || *cmd == '\0') { if (cmd == NULL || *cmd == '\0') {
cmd = wp->cmd; free(cmd);
if (cmd == NULL || *cmd == '\0') cmd = xstrdup(wp->cmd);
cmd = wp->shell; if (cmd == NULL || *cmd == '\0') {
free(cmd);
cmd = xstrdup(wp->shell);
}
} }
out = parse_window_name(cmd); out = parse_window_name(cmd);
free(cmd); free(cmd);