From aceedfe32e766b169d480c0ec24777d1b09bb118 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Thu, 14 Apr 2005 12:35:27 +0200 Subject: [PATCH] [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 --- checkout-cache.c | 2 ++ 1 file changed, 2 insertions(+) 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)); } -- 2.30.2