diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-11-17 21:12:41 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-11-17 22:34:07 +0100 |
commit | a16cc8b24710b7426468ac0dc3194170e6113385 (patch) | |
tree | a5349265d564945232362b38053fc17444139692 /unpack-trees.c | |
parent | git-tag.txt: Add a missing hyphen to `-s` (diff) | |
download | git-a16cc8b24710b7426468ac0dc3194170e6113385.tar.xz git-a16cc8b24710b7426468ac0dc3194170e6113385.zip |
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.c | 2 |
1 files changed, 2 insertions, 0 deletions
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: |