From: Taylor Blau Date: Fri, 05 Jan 2024 19:11:22 GMT Subject: Re: [PATCH] commit-graph: fix memory leak when not writing graph Message-ID: In-Reply-To: <0feab5e7d5bc6275e2c7671cd8f6786ea86fd610.1702891190.git.ps@pks.im> On Mon, Dec 18, 2023 at 11:02:28AM +0100, Patrick Steinhardt wrote: > When `write_commit_graph()` bails out writing a split commit-graph early > then it may happen that we have already gathered the set of existing > commit-graph file names without yet determining the new merged set of > files. This can result in a memory leak though because we only clear the > preimage of files when we have collected the postimage. > > Fix this issue by dropping the condition altogether so that we always > try to free both preimage and postimage filenames. As the context > structure is zero-initialized this simplification is safe to do. Looks obviously good to me, thanks for finding and fixing. Thanks, Taylor