[patch] git: cleanup in ls-tree.c
- From
- Ingo Molnar <mingo@elte.hu>
- Date
- Apr 14, 2005, 11:43 UTC
- Message-ID
- <20050414114344.GA13879@elte.hu>
- In-Reply-To
- <20050414113527.GA13790@elte.hu>
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.)
Ingo
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- ls-tree.c.orig +++ ls-tree.c
@@ -33,6 +33,8 @@ static int list(unsigned char *sha1) type = S_ISDIR(mode) ? "tree" : "blob"; printf("%03o\t%s\t%s\t%s\n", mode, type, sha1_to_hex(sha1), path); } + free(buffer); + return 0; }