public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++ <libstdc++@gcc.gnu.org>, gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v2] c++tools: Fix memory leak
Date: Tue, 26 Oct 2021 10:19:54 -0400	[thread overview]
Message-ID: <b19dedaf-915c-685f-0c7e-17899779c7fc@redhat.com> (raw)
In-Reply-To: <CACb0b4ktFWan9ex=pE5_xTWat9Qvwf0=bEV4uo-CgGJgMxqptQ@mail.gmail.com>

On 10/21/21 17:34, Jonathan Wakely wrote:
> On Thu, 21 Oct 2021 at 20:38, Jason Merrill wrote:
> 
>     On 10/21/21 09:28, Jonathan Wakely wrote:
>      >   #else
>      >     buffer = xmalloc (stat.st_size);
>      >     if (!buffer)
>      >       return -errno;
>      > +  struct Deleter { void operator()(void* p) const { free(p); } };
>      > +  std::unique_ptr<void, Deleter> guard;
> 
>     Don't you need to initialize guard from buffer?
> 
> 
> Oops, yes!  Updated patch attached.

OK, thanks.

Jason



      reply	other threads:[~2021-10-26 14:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 13:28 [PATCH] " Jonathan Wakely
2021-10-21 19:38 ` Jason Merrill
2021-10-21 21:34   ` [PATCH v2] " Jonathan Wakely
2021-10-26 14:19     ` Jason Merrill [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=b19dedaf-915c-685f-0c7e-17899779c7fc@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).