From 019d1e65f5bc715a40b1cd77852af0a649753c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Fri, 21 Feb 2014 06:47:47 +0700 Subject: sha1_file: fix delta_stack memory leak in unpack_entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- sha1_file.c | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- cgit v1.2.3