From: Patrick Steinhardt <ps@pks.im>
To: Toon Claes <toon@iotcl.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2] bundle-uri: plug leak in unbundle_from_file()
Date: Thu, 10 Oct 2024 14:55:14 +0200 [thread overview]
Message-ID: <ZwfOsoC35x-wyn7S@pks.im> (raw)
In-Reply-To: <20241010091249.1895960-1-toon@iotcl.com>
On Thu, Oct 10, 2024 at 11:12:49AM +0200, Toon Claes wrote:
> The function `unbundle_from_file()` has two memory leaks:
>
> - We do not release the `struct bundle_header header` when hitting
> errors because we return early without any cleanup.
>
> - We do not release the `struct strbuf bundle_ref` at all.
>
> Plug these leaks by creating a common exit path where both of these
> variables are released.
>
> While at it, refactor the code such that the variable assignments do not
> happen inside the conditional statement itself according to our coding
> style.
Thanks, this version looks good to me. We now avoid any discussion
around the changed error code completely, and the commit message seems
reasonable to me.
Thanks!
Patrick
next prev parent reply other threads:[~2024-10-10 12:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 8:30 [PATCH] bundle-uri: plug leak in unbundle_from_file() Toon Claes
2024-08-26 9:51 ` Patrick Steinhardt
2024-08-26 16:06 ` Junio C Hamano
2024-10-01 18:58 ` Toon Claes
2024-10-01 19:29 ` Junio C Hamano
2024-10-10 9:15 ` Toon Claes
2024-10-10 9:12 ` [PATCH v2] " Toon Claes
2024-10-10 12:55 ` Patrick Steinhardt [this message]
2024-10-10 18:47 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZwfOsoC35x-wyn7S@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=toon@iotcl.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).