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>
This commit is contained in:
parent
425df881e0
commit
e28f764159
@ -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…
Reference in New Issue
Block a user