diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-08-25 16:00:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-25 16:00:29 -0700 |
commit | 7abd8fb36d90cc68d471a04b59846d7816609116 (patch) | |
tree | 05d56b7a88106697cb72d6cee49e6c32cee09597 /merge-recursive.c | |
parent | 22f65789753e2ee874b28a38410bc64d6099e895 (diff) | |
parent | 03f622c81fed05bb571519beacb0eeaf595c65f4 (diff) | |
download | git-7abd8fb36d90cc68d471a04b59846d7816609116.tar.gz |
Merge branch 'jn/plug-empty-tree-leak'
* jn/plug-empty-tree-leak:
merge-recursive: take advantage of hardcoded empty tree
revert: plug memory leak in "cherry-pick root commit" codepath
Diffstat (limited to 'merge-recursive.c')
-rw-r--r-- | merge-recursive.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index 0cc1e6fc14..0804eb44e7 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1601,12 +1601,10 @@ int merge_recursive(struct merge_options *o, merged_common_ancestors = pop_commit(&ca); if (merged_common_ancestors == NULL) { - /* if there is no common ancestor, make an empty tree */ - struct tree *tree = xcalloc(1, sizeof(struct tree)); + /* if there is no common ancestor, use an empty tree */ + struct tree *tree; - tree->object.parsed = 1; - tree->object.type = OBJ_TREE; - pretend_sha1_file(NULL, 0, OBJ_TREE, tree->object.sha1); + tree = lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN); merged_common_ancestors = make_virtual_commit(tree, "ancestor"); } |