diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-10-21 14:17:43 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-10-21 22:23:00 +0100 |
commit | e6d100354317475412161a487ffbcf36582115c5 (patch) | |
tree | 9a23232d30c73bbdb763779027fea2f636516bdb | |
parent | 1373066a46d8d47abd97e46a005aef3b3dbfe94a (diff) | |
download | gcc-e6d100354317475412161a487ffbcf36582115c5.zip gcc-e6d100354317475412161a487ffbcf36582115c5.tar.gz gcc-e6d100354317475412161a487ffbcf36582115c5.tar.bz2 |
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.
-rw-r--r-- | libcody/netserver.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/libcody/netserver.cc b/libcody/netserver.cc index 30202c5..0499b57 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) { |