From: Jeff King Date: Fri, 19 Jun 2020 13:35:04 GMT Subject: Re: [PATCH] pull: plug minor memory leak after using is_descendant_of() Message-ID: <20200619133504.GC2540897@coredump.intra.peff.net> In-Reply-To: <52a584ee-ce2f-4416-3e3c-97ff15b5c346@web.de> On Fri, Jun 19, 2020 at 03:14:19PM +0200, René Scharfe wrote: > cmd_pull() builds a commit_list to pass a single potential ancestor to > is_descendant_of(). The latter leaves the list intact. Release the > allocated memory after the call. > > Leaking in cmd_*() isn't a big deal, but sets a bad example for other > users of is_descendant_of(). This also looks good to me. > --- > Patch generated with -U15 for easier review; only the pre-context is > interesting, though. --function-context would add even more noise. > A --block-context option might be nice (include surrounding lines up to > and including the previous and next lines with lower indentation). :) > Or perhaps it's a sign that the function should be split up.. I wondered how: git -c diff.cpp.funcname='.*{' show --function-context but think it always goes to the "^}" line, which is more than we want (plus the start of the block is in the hunk header, which makes the indentation look funky). -Peff