aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--trailer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/trailer.c b/trailer.c
index 682d74505b..6bafe92b32 100644
--- a/trailer.c
+++ b/trailer.c
@@ -249,7 +249,9 @@ static char *apply_command(struct conf_info *conf, const char *arg)
static void apply_item_command(struct trailer_item *in_tok, struct arg_item *arg_tok)
{
if (arg_tok->conf.command || arg_tok->conf.cmd) {
- const char *arg;
+ char *value_to_free = NULL;
+ char *arg;
+
if (arg_tok->value && arg_tok->value[0]) {
arg = arg_tok->value;
} else {
@@ -257,9 +259,13 @@ static void apply_item_command(struct trailer_item *in_tok, struct arg_item *arg
arg = xstrdup(in_tok->value);
else
arg = xstrdup("");
+ value_to_free = arg_tok->value;
}
+
arg_tok->value = apply_command(&arg_tok->conf, arg);
- free((char *)arg);
+
+ free(value_to_free);
+ free(arg);
}
}