From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id 71D843857C6A for ; Thu, 21 Oct 2021 13:30:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71D843857C6A Received: from mail-vk1-f200.google.com (mail-vk1-f200.google.com [209.85.221.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-555-0H21jkGkNsiBKbRQ2i_O8Q-1; Thu, 21 Oct 2021 09:30:18 -0400 X-MC-Unique: 0H21jkGkNsiBKbRQ2i_O8Q-1 Received: by mail-vk1-f200.google.com with SMTP id 199-20020a1f02d0000000b002a303be5f5eso238060vkc.8 for ; Thu, 21 Oct 2021 06:30:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TGEyrqSPBXuVChAgpMBxuRhOiaC5rV5XzG9iQPBTMlY=; b=kASlyzxhtZkauZANXSp9TxZ9Gl2yTXZQVJ2vtBBa89BITOLw1Jd3icgWHOjL+its+s P3s2ZweOMS4lr3M5kYIO9lY+2iN7/Fh3VC/Eg37GBYbnii6tnkJLneiPVvVZEWO+qbjg fAZYhX4Gkvfb51Z7E45E1PyMxWEluf65P2j7wIOvtflzhyxoyRgU/yUrSifPWSXJDQrR 53YMh0VV7KLcA5TklsB4hSJdpxb0EcwnrT97Q3AB5FHJnAFiwzgyLOpS2rWOxcctsIT1 FD8NVkWUhywU5FWaG4fXjEJkyhX0uHaGYiIJzuKuS6OtksKuicWTuYqt9/B3uBUFP7Yr z0DA== X-Gm-Message-State: AOAM531mInoD8ENSeN7mAY8JJjhlD37pu8gK9E+QU74czpacgmkTDdwx xVXtv0VUNHyfN5vNnUGYIg2VWIwmBqRvl1UU5B1vlcOIIctCgqkj54B/0Q+lARIFo0BW+aC1NVx YYX4d+sugQihAcSwJ94HzXUDpooSYCso= X-Received: by 2002:a05:6102:3049:: with SMTP id w9mr6064029vsa.4.1634823018129; Thu, 21 Oct 2021 06:30:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl2GLAIt21QSBSP6MLl6LIgrzugRuffSw/rJUXgBmhE05T3vPL1NAY7xcQhVlDxDf4lhjowbtDsInSXqpQNDk= X-Received: by 2002:a05:6102:3049:: with SMTP id w9mr6064001vsa.4.1634823017956; Thu, 21 Oct 2021 06:30:17 -0700 (PDT) MIME-Version: 1.0 References: <20211021132714.636039-1-jwakely@redhat.com> In-Reply-To: <20211021132714.636039-1-jwakely@redhat.com> From: Jonathan Wakely Date: Thu, 21 Oct 2021 14:30:07 +0100 Message-ID: Subject: Re: [PATCH] libcody: Avoid double-free To: "libstdc++" Cc: gcc Patches , Jason Merrill X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2021 13:30:21 -0000 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 > >