dermesser / libsocket

The ultimate socket library for C and C++, supporting TCP, UDP and Unix sockets (DGRAM and STREAM) on Linux, FreeBSD, Solaris. See also my uvco library for a refreshed version!
https://borgac.net/~lbo/doc/libsocket/
Other
797 stars 195 forks source link

Possible memory leak on failed inet stream socket connections #58

Closed thebaron06 closed 5 years ago

thebaron06 commented 5 years ago

When creating a inet stream socket using create_inet_stream_socket function, the hostname is resolved using getaddrinfo. On success this call returns a result list of possible endpoints that is only freed when a connection was successfully established. But if the connection was not possible, the list is never freed because the function leaves returning -1 without cleaning up.