From: Ingo Molnar Date: Thu, 14 Apr 2005 11:43:44 GMT Subject: [patch] git: cleanup in ls-tree.c 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 --- 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; }