summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorChad Loder <cloder@cvs.openbsd.org>2005-03-12 22:17:36 +0000
committerChad Loder <cloder@cvs.openbsd.org>2005-03-12 22:17:36 +0000
commit2db2114fe2ddad2723c4242f0404948cd7a9f0b8 (patch)
treed1a096f8837397f33ee09718f5413ce9d3aa9119 /usr.sbin
parent3ce77cfa27e699103a5b3f0c086b5beb652d253a (diff)
Do not leak mem or fd in error paths. From Andrey Matveev (thanks!).
OK niallo@ deraadt@: "stop polishing turds and commit already"
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/popa3d/standalone.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/popa3d/standalone.c b/usr.sbin/popa3d/standalone.c
index 0e9d6ba2d1e..43e9d82353e 100644
--- a/usr.sbin/popa3d/standalone.c
+++ b/usr.sbin/popa3d/standalone.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: standalone.c,v 1.8 2004/07/20 17:07:34 millert Exp $ */
+/* $OpenBSD: standalone.c,v 1.9 2005/03/12 22:17:35 cloder Exp $ */
/*
* Standalone POP server: accepts connections, checks the anti-flood limits,
@@ -136,8 +136,10 @@ int main(void)
i++;
pfds = calloc(i, sizeof(pfds[0]));
- if (!pfds)
+ if (!pfds) {
+ freeaddrinfo(res0);
return log_error("malloc");
+ }
i = 0;
for (res = res0; res; res = res->ai_next) {
@@ -247,7 +249,8 @@ handle(int sock)
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST);
if (error) {
syslog(SYSLOG_PRI_HI,
- "%s: invalid IP address", hbuf);
+ "could not get host address");
+ close(new);
return -1;
}