Merge branch 'ak/cat-file-clean-up'
[gitweb.git] / unpack-trees.c
index 256df47b3533bc085428d3fc5239173200a8e648..be84ba2607ad2dbdb17397869c459418abad78e4 100644 (file)
@@ -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: