From: Ingo Molnar Date: Thu, 14 Apr 2005 10:35:27 +0000 (+0200) Subject: [patch] git: fix memory leak #2 in checkout-cache.c X-Git-Tag: v0.99~591 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=aceedfe32e766b169d480c0ec24777d1b09bb118;p=git.git [patch] git: fix memory leak #2 in checkout-cache.c this patch fixes another (very rare) memory leak in checkout-cache. Signed-off-by: Ingo Molnar Signed-off-by: Petr Baudis --- diff --git a/checkout-cache.c b/checkout-cache.c index 64ce92147..b561ef487 100644 --- a/checkout-cache.c +++ b/checkout-cache.c @@ -77,6 +77,8 @@ static int write_entry(struct cache_entry *ce, const char *path) new = read_sha1_file(ce->sha1, type, &size); if (!new || strcmp(type, "blob")) { + if (new) + free(new); return error("checkout-cache: unable to read sha1 file of %s (%s)", path, sha1_to_hex(ce->sha1)); }