summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-11-17 20:12:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-11-17 21:34:07 (GMT)
commita16cc8b24710b7426468ac0dc3194170e6113385 (patch)
treea5349265d564945232362b38053fc17444139692 /unpack-trees.c
parenteeff891ac756fd97a05476446f15269b714ce4cc (diff)
downloadgit-a16cc8b24710b7426468ac0dc3194170e6113385.zip
git-a16cc8b24710b7426468ac0dc3194170e6113385.tar.gz
git-a16cc8b24710b7426468ac0dc3194170e6113385.tar.bz2
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 <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index ad3e9a0..2515be6 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: