sacc

sacc (saccomys): simple gopher client.
Log | Files | Refs | LICENSE

commit 10ed3e55246b65f39aa19f3c63bb0241c62d4f6c
parent 18a92be39ac2fea50ce2d63c7a03ad64528eb843
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Tue, 25 Dec 2018 19:32:54 +0100

freeaddrinfo can leak if a connection fails in connectto()

Diffstat:
sacc.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sacc.c b/sacc.c @@ -478,6 +478,9 @@ connectto(const char *host, const char *port) } break; } + + freeaddrinfo(addrs); + if (sock < 0) { diag("Can't open socket: %s", strerror(errno)); return -1; @@ -488,8 +491,6 @@ connectto(const char *host, const char *port) return -1; } - freeaddrinfo(addrs); - return sock; }