summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-02-21 06:47:47 +0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-02-24 09:07:12 -0800
commit019d1e65f5bc715a40b1cd77852af0a649753c56 (patch)
treed87eb6eb268177c6843964167a26a9f8d886f890
parentsha1_file: remove recursion in unpack_entry (diff)
downloadtgif-019d1e65f5bc715a40b1cd77852af0a649753c56.tar.xz
sha1_file: fix delta_stack memory leak in unpack_entry
This delta_stack array can grow to any length depending on the actual delta chain, but we forget to free it. Normally it does not matter because we use small_delta_stack[] from stack and small_delta_stack can hold 64-delta chains, more than standard --depth=50 in pack-objects. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--sha1_file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index b220a470f9..ca31de2df9 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2058,6 +2058,10 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
*final_size = size;
unuse_pack(&w_curs);
+
+ if (delta_stack != small_delta_stack)
+ free(delta_stack);
+
return data;
}