Skip to content

Commit

Permalink
fast-import: leakfix for 'ls' of dirty trees
Browse files Browse the repository at this point in the history
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 <jrnieder@gmail.com>
  • Loading branch information
Jonathan Nieder committed Mar 10, 2012
1 parent 8dc6a37 commit c27e559
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -2987,6 +2987,8 @@ static void parse_ls(struct branch *b)
store_tree(&leaf);

print_ls(leaf.versions[1].mode, leaf.versions[1].sha1, p);
if (leaf.tree)
release_tree_content_recursive(leaf.tree);
if (!b || root != &b->branch_tree)
release_tree_entry(root);
}
Expand Down

0 comments on commit c27e559

Please sign in to comment.