Re: [PATCH v2] revert: plug memory leak in "cherry-pick root commit" codepath
- From
Jeff King <peff@peff.net>
- Date
- Aug 16, 2011, 18:31 UTC
- Message-ID
- <20110816183147.GA10117@sigill.intra.peff.net>
- In-Reply-To
- <20110816181633.GB10336@elie.gateway.2wire.net>
On Tue, Aug 16, 2011 at 01:16:33PM -0500, Jonathan Nieder wrote:
Show 10 quoted lines
> 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);
> }Much nicer. But doesn't your dab0d41 (correct type of EMPTY_TREE_SHA1_BIN, 2011-02-07) make the cast unnecessary?
-Peff