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:
Jonathan Wakely 2021-10-21 14:17:43 +01:00
parent 1373066a46
commit e6d1003543

View File

@ -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)
{