Re: [PATCH v2] revert: plug memory leak in "cherry-pick root commit" codepath
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Aug 16, 2011, 18:56 UTC
- Message-ID
- <20110816185616.GE10336@elie.gateway.2wire.net>
- In-Reply-To
- <20110816183147.GA10117@sigill.intra.peff.net>
Jeff King wrote:
> On Tue, Aug 16, 2011 at 01:16:33PM -0500, Jonathan Nieder wrote:
Show 13 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?Yes, I was working against an older codebase (for no particular reason).