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 /builtin | |
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 'builtin')
-rw-r--r-- | builtin/revert.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/builtin/revert.c b/builtin/revert.c index 1f27c63343..3117776c2c 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) |