summaryrefslogtreecommitdiffstats
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authornicm <nicm>2019-04-25 18:18:55 +0000
committernicm <nicm>2019-04-25 18:18:55 +0000
commit32a81e197bce3b16113c7603a766773c1a5cdcaf (patch)
tree64a3819ff876c804c171a01e6444fda3dc7ff465 /cmd-show-options.c
parent1677bb0deaa0e5c3e962e36ce98076b0db8507f6 (diff)
Make options_tostring allocate its result instead of using a stack
buffer (needed for something in the future).
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r--cmd-show-options.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index b8b9a9bd..328e9c03 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -162,8 +162,8 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item,
struct options_entry *o, int idx)
{
struct options_array_item *a;
- const char *name, *value;
- char *tmp, *escaped;
+ const char *name;
+ char *value, *tmp, *escaped;
if (idx != -1) {
xasprintf(&tmp, "%s[%d]", options_name(o), idx);
@@ -191,6 +191,7 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item,
free(escaped);
} else
cmdq_print(item, "%s %s", name, value);
+ free(value);
free(tmp);
}