diff options
author | nicm <nicm> | 2016-09-26 09:02:34 +0000 |
---|---|---|
committer | nicm <nicm> | 2016-09-26 09:02:34 +0000 |
commit | 69e980602b31732348aaceee045a1901dc982d78 (patch) | |
tree | 65ed23e7becdf1845fccc2257506a40a3878994a /options.c | |
parent | eb50e7a2c87ed8c18f2944e0082e961acb70765b (diff) | |
download | rtmux-69e980602b31732348aaceee045a1901dc982d78.tar.gz rtmux-69e980602b31732348aaceee045a1901dc982d78.tar.bz2 rtmux-69e980602b31732348aaceee045a1901dc982d78.zip |
Support set -a (append) with user options, suggested by Xandor Schiefer.
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -128,19 +128,23 @@ options_set_string(struct options *oo, const char *name, const char *fmt, ...) { struct options_entry *o; va_list ap; + char *s; + s = NULL; if ((o = options_find1(oo, name)) == NULL) { o = xmalloc(sizeof *o); o->name = xstrdup(name); RB_INSERT(options_tree, &oo->tree, o); memcpy(&o->style, &grid_default_cell, sizeof o->style); } else if (o->type == OPTIONS_STRING) - free(o->str); + s = o->str; va_start(ap, fmt); o->type = OPTIONS_STRING; xvasprintf(&o->str, fmt, ap); va_end(ap); + + free(s); return (o); } |