mirror of git://gcc.gnu.org/git/gcc.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.
This commit is contained in:
parent
1373066a46
commit
e6d1003543
|
|
@ -140,6 +140,7 @@ int ListenInet6 (char const **e, char const *name, int port, unsigned backlog)
|
||||||
|
|
||||||
listen:;
|
listen:;
|
||||||
freeaddrinfo (addrs);
|
freeaddrinfo (addrs);
|
||||||
|
addrs = nullptr;
|
||||||
|
|
||||||
if (listen (fd, backlog ? backlog : 17) < 0)
|
if (listen (fd, backlog ? backlog : 17) < 0)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue