summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Martin Ågren <martin.agren@gmail.com>2019-01-22 22:45:47 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-01-23 13:15:58 -0800
commit13019979b811d26f4838d09331c7ddd8223d270d (patch)
tree14e2bd13bf4e4e294a2b90c45f92115f6ca37964
parentFirst batch after 2.20.1 (diff)
downloadtgif-13019979b811d26f4838d09331c7ddd8223d270d.tar.xz
setup: free old value before setting `work_tree`
Before assigning to `data->work_tree` in `read_worktree_config()`, free any value we might already have picked up, so that we do not leak it. Signed-off-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--setup.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/setup.c b/setup.c
index 1be5037f12..bb633942bb 100644
--- a/setup.c
+++ b/setup.c
@@ -411,6 +411,7 @@ static int read_worktree_config(const char *var, const char *value, void *vdata)
} else if (strcmp(var, "core.worktree") == 0) {
if (!value)
return config_error_nonbool(var);
+ free(data->work_tree);
data->work_tree = xstrdup(value);
}
return 0;