Re: [PATCH v3 17/26] submodule--helper: fix obscure leak in module_add()

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

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> Fix an obscure leak in module_add()< if the "git add" command we were

"<" -> "," perhaps?  I dunno.

> piping to failed we'd fail to strbuf_release(&sb). This fixes a leak
> introduced in a6226fd772b (submodule--helper: convert the bulk of
> cmd_add() to C, 2021-08-10).
>
> In fixing it move to a "goto cleanup" pattern, and since we need to
> introduce a "ret" variable to do that let's also get rid of the
> intermediate "exit_code" variable. The initialization to "-1" in
> a6226fd772b has always been redundant, we'd only use the "exit_code"
> value after assigning the return value of pipe_command() to it.
>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
> ---
>  builtin/submodule--helper.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)

The patch looks good, especially with removal of "exit_code" it is
very clear what is going on and how errors are handled.

Nicely done.




[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