summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Nieder <jrnieder@gmail.com>2012-03-09 21:20:34 -0600
committerLibravatar Jonathan Nieder <jrnieder@gmail.com>2012-03-09 22:02:44 -0600
commitc27e559da5b26faa31858fe6dc5492d4f605b867 (patch)
treed90cfd2048f611a2b2dcffa9a174ce46e437d795 /fast-import.c
parentfast-import: add 'ls' command (diff)
downloadtgif-c27e559da5b26faa31858fe6dc5492d4f605b867.tar.xz
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 <jrnieder@gmail.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fast-import.c b/fast-import.c
index 6c37b8400a..fff285cd0f 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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);
}