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>maint
parent
eeff891ac7
commit
a16cc8b247
|
@ -1157,6 +1157,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
|
||||||
if (o->dst_index) {
|
if (o->dst_index) {
|
||||||
discard_index(o->dst_index);
|
discard_index(o->dst_index);
|
||||||
*o->dst_index = o->result;
|
*o->dst_index = o->result;
|
||||||
|
} else {
|
||||||
|
discard_index(&o->result);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
Loading…
Reference in New Issue