summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJonathan Matthew <jmatthew@cvs.openbsd.org>2012-03-16 01:57:43 +0000
committerJonathan Matthew <jmatthew@cvs.openbsd.org>2012-03-16 01:57:43 +0000
commit8dcb4c1bc1b986d79f4bb185f9e6bbf2a1e44877 (patch)
treeaa62a44173d6240157472e01468729f180464382 /usr.sbin
parentcac07d34d1a0123dd107c7db8c91c983978ee5cc (diff)
don't leak ypldap_addr structures when doing dns lookups
ok dlg@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ypldap/ypldap_dns.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.sbin/ypldap/ypldap_dns.c b/usr.sbin/ypldap/ypldap_dns.c
index 105160de89c..06e13f9f11b 100644
--- a/usr.sbin/ypldap/ypldap_dns.c
+++ b/usr.sbin/ypldap/ypldap_dns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypldap_dns.c,v 1.4 2010/05/26 13:56:08 nicm Exp $ */
+/* $OpenBSD: ypldap_dns.c,v 1.5 2012/03/16 01:57:42 jmatthew Exp $ */
/*
* Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org>
@@ -172,9 +172,15 @@ dns_dispatch_imsg(int fd, short event, void *p)
cnt * sizeof(struct sockaddr_storage));
if (buf == NULL)
break;
- if (cnt > 0)
- for (h = hn; h != NULL; h = h->next)
+ if (cnt > 0) {
+ h = hn;
+ while (h != NULL) {
imsg_add(buf, &h->ss, sizeof(h->ss));
+ hn = h->next;
+ free(h);
+ h = hn;
+ }
+ }
imsg_close(ibuf, buf);
break;