From: Jonathan Wakely Date: Thu, 21 Oct 2021 13:17:43 +0000 (+0100) Subject: libcody: Avoid double-free X-Git-Tag: basepoints/gcc-13~3693 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6d100354317475412161a487ffbcf36582115c5;p=thirdparty%2Fgcc.git libcody: Avoid double-free 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. --- diff --git a/libcody/netserver.cc b/libcody/netserver.cc index 30202c5106ab..0499b5790b45 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) {