Skip to content

Commit c27e559

Browse files
committed
fast-import: leakfix for 'ls' of dirty trees
When the chosen directory has changed since it was last written to pack, "tree_content_get" makes a deep copy of its content to scribble on while computing the tree name, which we forgot to free. This leak has been present since the 'ls' command was introduced in v1.7.5-rc0~3^2~33 (fast-import: add 'ls' command, 2010-12-02). Signed-off-by: Jonathan Nieder <[email protected]>
1 parent 8dc6a37 commit c27e559

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fast-import.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2987,6 +2987,8 @@ static void parse_ls(struct branch *b)
29872987
store_tree(&leaf);
29882988

29892989
print_ls(leaf.versions[1].mode, leaf.versions[1].sha1, p);
2990+
if (leaf.tree)
2991+
release_tree_content_recursive(leaf.tree);
29902992
if (!b || root != &b->branch_tree)
29912993
release_tree_entry(root);
29922994
}

0 commit comments

Comments
 (0)