From: Jonathan Nieder Date: Thu, 08 Mar 2012 20:31:39 GMT Subject: [PATCH 1/2] fast-import: plug leak of dirty trees in 'ls' command Message-ID: <20120308203139.GB8992@burratino> In-Reply-To: <20120308202721.GA8992@burratino> When the named directory has changed since it was last written to pack, "tree_content_get" makes a deep copy of the list of tree entries which we forgot to free. This memory 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 --- After rediscovering this, I found [1] which mentions the same bug. [1] http://thread.gmane.org/gmane.comp.version-control.git/178007/focus=178044 fast-import.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fast-import.c b/fast-import.c index c1486cab..1758da94 100644 --- a/fast-import.c +++ b/fast-import.c @@ -3028,6 +3028,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); } -- 1.7.9.2