[patch] git: cleanup in ls-tree.c
authorIngo Molnar <mingo@elte.hu>
Thu, 14 Apr 2005 10:43:44 +0000 (12:43 +0200)
committerPetr Baudis <xpasky@machine.sinus.cz>
Wed, 11 May 2005 21:08:20 +0000 (23:08 +0200)
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>
ls-tree.c

index 7f8f8644afbcec3eac39230cabbd1298ceaa537d..4231c4b234d8c8a5a35adb3d15ad9cd1f7dcf51a 100644 (file)
--- 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;
 }