Skip to content

Commit a16cc8b

Browse files
committed
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>
1 parent eeff891 commit a16cc8b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

unpack-trees.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,8 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
11571157
if (o->dst_index) {
11581158
discard_index(o->dst_index);
11591159
*o->dst_index = o->result;
1160+
} else {
1161+
discard_index(&o->result);
11601162
}
11611163

11621164
done:

0 commit comments

Comments
 (0)