summaryrefslogtreecommitdiff
path: root/builtin/revert.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-08-25 23:00:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-25 23:00:29 (GMT)
commit7abd8fb36d90cc68d471a04b59846d7816609116 (patch)
tree05d56b7a88106697cb72d6cee49e6c32cee09597 /builtin/revert.c
parent22f65789753e2ee874b28a38410bc64d6099e895 (diff)
parent03f622c81fed05bb571519beacb0eeaf595c65f4 (diff)
downloadgit-7abd8fb36d90cc68d471a04b59846d7816609116.zip
git-7abd8fb36d90cc68d471a04b59846d7816609116.tar.gz
git-7abd8fb36d90cc68d471a04b59846d7816609116.tar.bz2
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 'builtin/revert.c')
-rw-r--r--builtin/revert.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/builtin/revert.c b/builtin/revert.c
index 1f27c63..3117776 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -258,12 +258,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
static struct tree *empty_tree(void)
{
- struct tree *tree = xcalloc(1, sizeof(struct tree));
-
- tree->object.parsed = 1;
- tree->object.type = OBJ_TREE;
- pretend_sha1_file(NULL, 0, OBJ_TREE, tree->object.sha1);
- return tree;
+ return lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN);
}
static NORETURN void die_dirty_index(const char *me)