summaryrefslogtreecommitdiff
path: root/checkout-cache.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2005-04-14 10:35:27 (GMT)
committerPetr Baudis <xpasky@machine.sinus.cz>2005-05-11 21:05:47 (GMT)
commitaceedfe32e766b169d480c0ec24777d1b09bb118 (patch)
tree237f72047e142a6f67f77d5b1ca29c121b8d84ed /checkout-cache.c
parent06cd3b94b27c285fc9877e7c6d9e1f35fbc0a7a4 (diff)
downloadgit-aceedfe32e766b169d480c0ec24777d1b09bb118.zip
git-aceedfe32e766b169d480c0ec24777d1b09bb118.tar.gz
git-aceedfe32e766b169d480c0ec24777d1b09bb118.tar.bz2
[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 <mingo@elte.hu> Signed-off-by: Petr Baudis <pasky@ucw.cz>
Diffstat (limited to 'checkout-cache.c')
-rw-r--r--checkout-cache.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/checkout-cache.c b/checkout-cache.c
index 64ce921..b561ef4 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));
}