From a16cc8b24710b7426468ac0dc3194170e6113385 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 17 Nov 2014 12:12:41 -0800 Subject: unpack_trees: plug leakage of o->result Most of the time the caller specifies to which destination variable the resulting index_state should be assigned by passing a non-NULL pointer in o->dst_index to receive that state, but for a caller that gives a NULL o->dst_index, the resulting index simply leaked. Signed-off-by: Junio C Hamano --- unpack-trees.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'unpack-trees.c') diff --git a/unpack-trees.c b/unpack-trees.c index ad3e9a04fe..2515be6a60 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -1157,6 +1157,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options if (o->dst_index) { discard_index(o->dst_index); *o->dst_index = o->result; + } else { + discard_index(&o->result); } done: -- cgit v1.2.1