[patch] git: fix memory leak #2 in checkout-cache.c
- From
- Ingo Molnar <mingo@elte.hu>
- Date
- Apr 14, 2005, 11:35 UTC
- Message-ID
- <20050414113527.GA13790@elte.hu>
- In-Reply-To
- <20050414112638.GA12593@elte.hu>
this patch fixes another (very rare) memory leak in checkout-cache.
Ingo
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- checkout-cache.c.orig +++ checkout-cache.c
@@ -74,6 +74,8 @@ static int write_entry(struct cache_entr 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)", ce->name, sha1_to_hex(ce->sha1)); }