From: Karthik Nayak Date: Wed, 20 Mar 2024 23:23:54 GMT Subject: Re: [PATCH 10/15] builtin/pack-refs: release allocated memory Message-ID: In-Reply-To: Patrick Steinhardt writes: > Some of the command line options in `cmd_pack_refs()` require us to > allocate memory. This memory is never released and thus leaking, but we > paper over this leak by declaring the respective variables as `static` > function-level variables, which is somewhat awkward. > > Refactor the code to release the allocated memory and drop the `static` > declaration. While at it, remove the useless `flags` variable. > Tangent: I was looking at `files_pack_refs` and it seems like there are a bunch of `die(...)` calls there. I wonder if it would be nicer to use `error()` instead so we could do a better job at cleanup.