diff options
author | nicm <nicm> | 2015-05-29 23:12:38 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-05-29 23:12:38 +0000 |
commit | 74c755f2aba6402f9ec51fc6b4b61560884af46d (patch) | |
tree | da5661eb1bef4e34135a3ee0a585923123f01f29 | |
parent | a55e569af513deb99258354822ee75cbdce83619 (diff) | |
download | rtmux-74c755f2aba6402f9ec51fc6b4b61560884af46d.tar.gz rtmux-74c755f2aba6402f9ec51fc6b4b61560884af46d.tar.bz2 rtmux-74c755f2aba6402f9ec51fc6b4b61560884af46d.zip |
Expand formats again inside #(), and free the temporaries.
-rw-r--r-- | format.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |