Re: [PATCH 09/23] builtin/remote: fix leaking strings in `branch_list`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jul 31, 2024, 16:37 UTC
- Message-ID
- <ZqpoQFFmGQa25veh@nand.local>
- In-Reply-To
- <6952fb2ff2cf453de39b63883a716a9f09cab7b7.1721995576.git.ps@pks.im>
On Fri, Jul 26, 2024 at 02:15:36PM +0200, Patrick Steinhardt wrote:
Show 7 quoted lines
> @@ -292,8 +292,8 @@ static int config_read_branches(const char *key, const char *value, > type = PUSH_REMOTE; > else > return 0; > - name = xmemdupz(key, key_len); > > + name = xmemdupz(key, key_len);
I stared at this for longer than I'd like to admit wondering if there was a whitespace error in the pre-image or something. But I see you just moved initializing 'name' next to the initialization of 'item'.
I'd argue that might be a stray diff, but I don't think it matters much.
Show 10 quoted lines
> item = string_list_insert(&branch_list, name);
>
> if (!item->util)
> @@ -337,6 +337,7 @@ static int config_read_branches(const char *key, const char *value,
> BUG("unexpected type=%d", type);
> }
>
> + free(name);
> return 0;
> }The patch looks good to me otherwise.
Thanks, Taylor