Browse Source

unpack-trees: plug a memory leak

Before overwriting the destination index, first let's discard its
contents.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Tested-by: Лежанкин Иван <abyss.7@gmail.com> wrote:
Reviewed-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Felipe Contreras 12 years ago committed by Junio C Hamano
parent
commit
e28f764159
  1. 4
      unpack-trees.c

4
unpack-trees.c

@ -1154,8 +1154,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options @@ -1154,8 +1154,10 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options

o->src_index = NULL;
ret = check_updates(o) ? (-2) : 0;
if (o->dst_index)
if (o->dst_index) {
discard_index(o->dst_index);
*o->dst_index = o->result;
}

done:
clear_exclude_list(&el);

Loading…
Cancel
Save