freeaddrinfo can leak if a connection fails in connectto() - sacc - sacc(omys), simple console gopher client
(HTM) git clone git://bitreich.org/sacc/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/sacc/
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) LICENSE
---
(DIR) commit 10ed3e55246b65f39aa19f3c63bb0241c62d4f6c
(DIR) parent 18a92be39ac2fea50ce2d63c7a03ad64528eb843
(HTM) 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:
M sacc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
---
(DIR) 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;
}