X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=unpack-trees.c;h=f561d88156b827b15bad7dd4e00f944718149bd9;hb=af24059fa299f1656692f5807eddd3b30b5f3cfb;hp=8cf0da317d8afe4bfe3cae7051e3a385d44cf7ef;hpb=fcd91f8de20bf7969599a7a60cba73117d99f2d1;p=git.git diff --git a/unpack-trees.c b/unpack-trees.c index 8cf0da317..f561d8815 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -329,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; @@ -346,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; }