freeaddrinfo can leak if a connection fails in connectto() - sacc - sacc(omys), simple console gopher client | |
git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/ | |
Log | |
Files | |
Refs | |
Tags | |
LICENSE | |
--- | |
commit 10ed3e55246b65f39aa19f3c63bb0241c62d4f6c | |
parent 18a92be39ac2fea50ce2d63c7a03ad64528eb843 | |
Author: Hiltjo Posthuma | |
Date: Tue, 25 Dec 2018 19:32:54 +0100 freeaddrinfo can leak if a connection fails in connectto() Diffstat: M 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; } |