summaryrefslogtreecommitdiff
path: root/builtin/checkout.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2021-09-27 16:33:39 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-27 20:38:37 (GMT)
commitc512d27e787e9eb325731ab6aa7ac126f8cf6126 (patch)
tree2d07b5058c40a43be661004080406769e728a0f5 /builtin/checkout.c
parent446cc5544a3cb8dbd0ddac5bc5b160a687eb6471 (diff)
downloadgit-c512d27e787e9eb325731ab6aa7ac126f8cf6126.zip
git-c512d27e787e9eb325731ab6aa7ac126f8cf6126.tar.gz
git-c512d27e787e9eb325731ab6aa7ac126f8cf6126.tar.bz2
checkout, read-tree: fix leak of unpack_trees_options.dir
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/checkout.c')
-rw-r--r--builtin/checkout.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 8c69dcd..5335435 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -760,6 +760,10 @@ static int merge_working_tree(const struct checkout_opts *opts,
init_tree_desc(&trees[1], tree->buffer, tree->size);
ret = unpack_trees(2, trees, &topts);
+ if (topts.dir) {
+ dir_clear(topts.dir);
+ FREE_AND_NULL(topts.dir);
+ }
clear_unpack_trees_porcelain(&topts);
if (ret == -1) {
/*