From: Rubén Justo Date: Mon, 10 Oct 2022 18:08:36 GMT Subject: Re: [PATCH v5] branch: support for shortcuts like @{-1}, completed Message-ID: <7d51d297-7a18-de05-0da8-a93276455471@gmail.com> In-Reply-To: On 10/10/22 18:55, Junio C Hamano wrote: > Rubén Justo 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). > Just to say that I truly agree. Un saludo.