Skip to content

Commit

Permalink
unpack_trees: plug leakage of o->result
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Nov 17, 2014
1 parent eeff891 commit a16cc8b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions unpack-trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a16cc8b

Please sign in to comment.