summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-10 08:02:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-10 08:02:53 (GMT)
commit438776e3d48779417a7f9cfc6eaf0bb58d7d6cca (patch)
treeeb35567c3b3b5a096a63210d3df3c11ee18201f3
parentc3b931e162919da99517cc6b0d73303befcfd1db (diff)
parent896dca3ab75de69e292d7863d704b3e7a8f1a59d (diff)
downloadgit-438776e3d48779417a7f9cfc6eaf0bb58d7d6cca.zip
git-438776e3d48779417a7f9cfc6eaf0bb58d7d6cca.tar.gz
git-438776e3d48779417a7f9cfc6eaf0bb58d7d6cca.tar.bz2
Merge branch 'rs/unpack-entry-leakfix' into maint
Memory leak in an error codepath has been plugged. * rs/unpack-entry-leakfix: sha1_file: release delta_stack on error in unpack_entry()
-rw-r--r--sha1_file.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c
index b60ae15..b7bb38b 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2542,8 +2542,8 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
error("bad packed object CRC for %s",
sha1_to_hex(sha1));
mark_bad_packed_object(p, sha1);
- unuse_pack(&w_curs);
- return NULL;
+ data = NULL;
+ goto out;
}
}
@@ -2681,6 +2681,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
if (final_size)
*final_size = size;
+out:
unuse_pack(&w_curs);
if (delta_stack != small_delta_stack)