diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-05-29 23:12:39 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-05-29 23:12:39 +0000 |
commit | 408baf24185708aee6a68dbdc4b3b43a210cdca5 (patch) | |
tree | d6563263e4c2eb3e2c5c5920ed5c8f19e601e76c /usr.bin/tmux/format.c | |
parent | 42c994bba350504bdb9cda0cdaa004cda114ee22 (diff) |
Expand formats again inside #(), and free the temporaries.
Diffstat (limited to 'usr.bin/tmux/format.c')
-rw-r--r-- | usr.bin/tmux/format.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index f7bbd8971e1..9a8be293442 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.68 2015/05/27 13:28:04 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.69 2015/05/29 23:12:38 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net> @@ -490,7 +490,7 @@ format_expand_time(struct format_tree *ft, const char *fmt, time_t t) char * format_expand(struct format_tree *ft, const char *fmt) { - char *buf, *tmp; + char *buf, *tmp, *cmd; const char *ptr, *s; size_t off, len, n, slen; int ch, brackets; @@ -530,10 +530,14 @@ format_expand(struct format_tree *ft, const char *fmt) tmp = xmalloc(n + 1); memcpy(tmp, fmt, n); tmp[n] = '\0'; + cmd = format_expand(ft, tmp); - s = format_job_get(ft, tmp); + s = format_job_get(ft, cmd); slen = strlen(s); + free(cmd); + free(tmp); + while (len - off < slen + 1) { buf = xreallocarray(buf, 2, len); len *= 2; |