Merge branch 'rs/unpack-entry-leakfix' into next
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Aug 2017 20:53:02 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Aug 2017 20:53:02 +0000 (13:53 -0700)
Memory leak in an error codepath has been plugged.

* rs/unpack-entry-leakfix:
sha1_file: release delta_stack on error in unpack_entry()

sha1_file.c
index 607b34ea53609a4d34e90fabc97dfef2fc6c3d05..81d03ce8591ce318c0ecb0fd0491e06783a67dfc 100644 (file)
@@ -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)