summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2013-10-11 08:03:43 +0000
committernicm <nicm>2013-10-11 08:03:43 +0000
commit98b81e983428c7770022c698a0c4ef3c7fc4ea36 (patch)
tree3bb87813746c1fa3ddf488ceb0cdcf13d0be5b34
parent17ec688ced8c1d6104cab700f9713cfa0fa1f858 (diff)
And get it right this time... don't leak if it is an empty string either.
-rw-r--r--format.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/format.c b/format.c
index 14dcd000..bfc40906 100644
--- a/format.c
+++ b/format.c
@@ -357,9 +357,12 @@ format_get_command(struct window_pane *wp)
cmd = get_proc_name(wp->fd, wp->tty);
if (cmd == NULL || *cmd == '\0') {
- cmd = wp->cmd;
- if (cmd == NULL || *cmd == '\0')
- cmd = wp->shell;
+ free(cmd);
+ cmd = xstrdup(wp->cmd);
+ if (cmd == NULL || *cmd == '\0') {
+ free(cmd);
+ cmd = xstrdup(wp->shell);
+ }
}
out = parse_window_name(cmd);
free(cmd);