Re: [PATCH 01/23] builtin/replay: plug leaking `advance_name` variable
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jul 31, 2024, 16:22 UTC
- Message-ID
- <Zqpks6Oi7I4TAk2f@nand.local>
- In-Reply-To
- <dd044eacc2b20c3e426f5825fdc30f4db6618052.1721995576.git.ps@pks.im>
On Fri, Jul 26, 2024 at 02:13:59PM +0200, Patrick Steinhardt wrote:
Show 15 quoted lines
> The `advance_name` variable can either contain a static string when > parsed via the `--advance` command line option or it may be an allocated > string when set via `determine_replay_mode()`. Because we cannot be sure > whether it is allocated or not we just didn't free it at all, resulting > in a memory leak. > > Split up the variables such that we can track the static and allocated > strings separately and then free the allocated one to fix the memory > leak. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > --- > builtin/replay.c | 20 ++++++++++++++------ > t/t3650-replay-basics.sh | 1 + > 2 files changed, 15 insertions(+), 6 deletions(-)
I had to read this patch a couple of times to make sure that I understood the flow into and out of determine_replay_mode(). But after reading it a couple of times, I agree with the change that you made here.
Thanks, Taylor