From: Junio C Hamano <gitster@pobox.com>
To: Derrick Stolee <stolee@gmail.com>
Cc: Eric Wong <e@80x24.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
git@vger.kernel.org
Subject: Re: [PATCH] object-file: fix leak on conversion failure
Date: Mon, 24 Jun 2024 09:08:03 -0700 [thread overview]
Message-ID: <xmqq8qyue330.fsf@gitster.g> (raw)
In-Reply-To: <1f536f91-1dce-4156-98f2-4059cd5235ff@gmail.com> (Derrick Stolee's message of "Sun, 23 Jun 2024 12:34:51 -0400")
Derrick Stolee <stolee@gmail.com> writes:
> On 6/22/24 12:36 AM, Eric Wong wrote:
>> I'm not sure exactly how to trigger the leak, but it seems fairly
>> obvious that the `content' buffer should be freed even if
>> convert_object_file() fails. Noticed while working in this area
>> on unrelated things.
>
> Definitely a good thing to include, even if it is unlikely to
> be hit frequently in common scenarios.
>
>> ret = convert_object_file(&outbuf,
>> the_hash_algo, input_algo,
>> content, size, type, !do_die);
>> + free(content);
>> if (ret == -1)
>> return -1;
>> - free(content);
>
> I looked at the context of this function to see that 'content'
> was local to the method, so was not "owned" by something outside
> of the method that might expect to reuse the buffer on failure.
Thanks, both.
Will queue.
prev parent reply other threads:[~2024-06-24 16:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-22 4:36 [PATCH] object-file: fix leak on conversion failure Eric Wong
2024-06-23 16:34 ` Derrick Stolee
2024-06-24 16:08 ` Junio C Hamano [this message]
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=xmqq8qyue330.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=e@80x24.org \
--cc=ebiederm@xmission.com \
--cc=git@vger.kernel.org \
--cc=stolee@gmail.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).