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>
This commit is contained in:
Elijah Newren
2021-09-27 16:33:39 +00:00
committed by Junio C Hamano
parent 446cc5544a
commit c512d27e78
2 changed files with 9 additions and 0 deletions

View File

@ -250,6 +250,11 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
if (unpack_trees(nr_trees, t, &opts))
return 128;
if (opts.dir) {
dir_clear(opts.dir);
FREE_AND_NULL(opts.dir);
}
if (opts.debug_unpack || opts.dry_run)
return 0; /* do not write the index out */