summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Ingo Molnar <mingo@elte.hu>2005-04-14 12:43:44 +0200
committerLibravatar Petr Baudis <xpasky@machine.sinus.cz>2005-05-11 23:08:20 +0200
commitc599caca3ab7d5d66d7cadbbf589c2e4b5587d3e (patch)
tree3307e3b228f1134c554cca619a7ef6e5643a4701
parent[patch] git: fix memory leak #2 in checkout-cache.c (diff)
downloadtgif-c599caca3ab7d5d66d7cadbbf589c2e4b5587d3e.tar.xz
[patch] git: cleanup in ls-tree.c
cleanup: this patch adds a free() to ls-tree.c. (Technically it's not a memory leak yet because the buffer is allocated once by the function and then the utility exits - but it's a tad cleaner to not leave such assumptions in the code, so that if someone reuses the function (or extends the utility to include a loop) the uncleanliness doesnt develop into a real memory leak.) Signed-off-by: Ingo Molnar <mingo@elte.hu> Forward-ported. Signed-off-by: Petr Baudis <pasky@ucw.cz>
-rw-r--r--ls-tree.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ls-tree.c b/ls-tree.c
index 7f8f8644af..4231c4b234 100644
--- a/ls-tree.c
+++ b/ls-tree.c
@@ -77,6 +77,7 @@ static int list(unsigned char *sha1)
if (!buffer)
die("unable to read sha1 file");
list_recursive(buffer, "tree", size, NULL);
+ free(buffer);
return 0;
}