public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>, Jason Merrill <jason@redhat.com>
Subject: Re: [PATCH] libcody: Avoid double-free
Date: Thu, 21 Oct 2021 14:30:07 +0100	[thread overview]
Message-ID: <CACb0b4kkYLgSv-_UEO-YgbnD=gkX_F3wQ-FXh=amq9=tGQipOA@mail.gmail.com> (raw)
In-Reply-To: <20211021132714.636039-1-jwakely@redhat.com>

Oops, this patch and the next one were only meant for gcc-patches, not the
libstdc++ list as well - sorry!


On Thu, 21 Oct 2021 at 14:27, Jonathan Wakely via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

> If the listen call fails then 'goto fail' will jump to that label and
> use freeaddrinfo again. Set the pointer to null to prevent that.
>
> libcody/ChangeLog:
>
>         * netserver.cc (ListenInet6): Set pointer to null after
>         deallocation.
> ---
>  libcody/netserver.cc | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libcody/netserver.cc b/libcody/netserver.cc
> index 30202c5106a..0499b5790b4 100644
> --- a/libcody/netserver.cc
> +++ b/libcody/netserver.cc
> @@ -140,6 +140,7 @@ int ListenInet6 (char const **e, char const *name, int
> port, unsigned backlog)
>
>   listen:;
>    freeaddrinfo (addrs);
> +  addrs = nullptr;
>
>    if (listen (fd, backlog ? backlog : 17) < 0)
>      {
> --
> 2.31.1
>
>

      reply	other threads:[~2021-10-21 13:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 13:27 Jonathan Wakely
2021-10-21 13:30 ` Jonathan Wakely [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='CACb0b4kkYLgSv-_UEO-YgbnD=gkX_F3wQ-FXh=amq9=tGQipOA@mail.gmail.com' \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@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).