Subject: Re: [PATCH v5] branch: support for shortcuts like @{-1}, completed

From: Junio C Hamano <[email-masked]>
Date: Mon, 10 Oct 2022 09:55:38 -0700

Rubén Justo <[email-masked]> writes:

>> If we have a big common clean-up after each operation, then, falling
>> through in the success case might be good, but that is not what I am
>> seeing here.  So...
>> 
>
> I would like to see some kind of free(head) in a clean-up to not get
> distracted with that.  Not a proper leak though and the leak checkers
> does not refer to that as leak.  So not important.  We can go with the
> unconditional return and let the dust settle.

"head" is not leaking, as a pointer to it is head in a location that
is still in scope (namely, a file-scope global variable) when the
program exits.

In fact, the only thing the code before or after this patch does
after leaving this top-level if/elseif/else cascade is to return 0
and doing nothing else.  Inserting free(head) would be an unneeded
distraction for human developers (doing such a patch, reviewing, and
even worse, having to read the resulting code in the coming years)
and waste of computer resources (exiting the process will reclaim
such a piece of memory just fine).