Re: [PATCH v2 2/4] xdiff/xprepare: refactor abort cleanups
- From
Tay Ray Chuan <rctay89@gmail.com>
- Date
- Jul 6, 2011, 18:10 UTC
- Message-ID
- <CALUzUxqPf0nReHHhQ3zJoVbPAN7GNuzWeunWoxbzLuoYtuEbUw@mail.gmail.com>
- In-Reply-To
- <7vliwbmgv0.fsf@alter.siamese.dyndns.org>
On Thu, Jul 7, 2011 at 1:57 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 9 quoted lines
> Tay Ray Chuan <rctay89@gmail.com> writes: > >> Group free()'s that are called when a malloc() fails in >> xdl_prepare_ctx(), making for more readable code. > > Nicer, but I wonder if we can get away with a single label that lets us > abort with freeing whatever we have allocated by making sure that the > various pointer fields and variables are initialized to NULL, which may > lead to even more readable code.
Pardon my dullness. Do you mean to check if the various fields are set to NULL upon allocation, and free()'ing them if so?
-- Cheers, Ray Chuan