X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=unpack-trees.c;h=f561d88156b827b15bad7dd4e00f944718149bd9;hb=1b6ecbad3511b1aaa65172ef8b520dd3b5141614;hp=e8f03f51541472ead12d55672ba4422f97a3c113;hpb=e5498e8a9f9a596ecff78426bbf904626cd7863a;p=git.git diff --git a/unpack-trees.c b/unpack-trees.c index e8f03f515..f561d8815 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -279,9 +279,11 @@ static void add_same_unmerged(struct cache_entry *ce, static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_options *o) { - struct cache_entry *src[5] = { ce, NULL, }; + struct cache_entry *src[5] = { NULL }; int ret; + src[0] = ce; + mark_ce_used(ce, o); if (ce_stage(ce)) { if (o->skip_unmerged) { @@ -327,6 +329,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long { int i, ret, bottom; struct tree_desc t[MAX_UNPACK_TREES]; + void *buf[MAX_UNPACK_TREES]; struct traverse_info newinfo; struct name_entry *p; @@ -344,12 +347,16 @@ static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long const unsigned char *sha1 = NULL; if (dirmask & 1) sha1 = names[i].sha1; - fill_tree_descriptor(t+i, sha1); + buf[i] = fill_tree_descriptor(t+i, sha1); } bottom = switch_cache_bottom(&newinfo); ret = traverse_trees(n, t, &newinfo); restore_cache_bottom(&newinfo, bottom); + + for (i = 0; i < n; i++) + free(buf[i]); + return ret; }