Re: [PATCH v4 0/5] rebase: cleanup merge strategy option handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 10, 2023 at 2:08 AM Phillip Wood <phillip.wood123@xxxxxxxxx> wrote:
>
> From: Phillip Wood <phillip.wood@xxxxxxxxxxxxx>
>
> Cleanup the handling of --strategy-option now that we no longer need to
> support "--preserve-merges" and properly quote the argument when saving
> it to disc.
>
> A hopefully final re-roll to fix a memory leak I spotted in V3.

Doh, I clearly missed that leak too.

> Changes since V3:
>  - Fixed a memory leak added in V3. The array returned by
>    split_cmdline() is allocated on the heap so we need to fee it. The
>    array elements come from the string passed to split_cmdline() so do
>    not need to be individually freed.

And in particular, that string that stores those array elements will
be freed by the strbuf_reset() that comes immediately after the
read_strategy_opts() call (read_strategy_opts() is the sole caller of
parse_strategy_opts()), and the fact that the string is freed is fine
since your parse_strategy_opts() passes them to strvec_push() which
will xstrdup() them and then own them.

All that to say I agree with the fix.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux