public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4620] libcody: Avoid double-free
@ 2021-10-21 21:31 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-10-21 21:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e6d100354317475412161a487ffbcf36582115c5
commit r12-4620-ge6d100354317475412161a487ffbcf36582115c5
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Oct 21 14:17:43 2021 +0100
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:
---
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)
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-21 21:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21 21:31 [gcc r12-4620] libcody: Avoid double-free Jonathan Wakely
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).