summaryrefslogtreecommitdiff
path: root/libexec/rshd
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-11-10 17:45:44 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-11-10 17:45:44 +0000
commit5c6d1a27a1486c8d2084307633e03320a43bdd74 (patch)
tree37729d36d791e2bf35fa19742e874e10db6de78e /libexec/rshd
parent9d3439a33e74e7f923bff60df0fd0e65b9f15741 (diff)
correct call to freeaddrinfo. do not free region before referenced.
reported by ryo@iij.ad.jp for kame/netbsd, and aaron.
Diffstat (limited to 'libexec/rshd')
-rw-r--r--libexec/rshd/rshd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c
index 1b3c8fb377d..e84669aa169 100644
--- a/libexec/rshd/rshd.c
+++ b/libexec/rshd/rshd.c
@@ -39,7 +39,7 @@ static char copyright[] =
#ifndef lint
/* from: static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; */
-static char *rcsid = "$Id: rshd.c,v 1.33 2000/09/15 07:13:47 deraadt Exp $";
+static char *rcsid = "$Id: rshd.c,v 1.34 2000/11/10 17:45:43 itojun Exp $";
#endif /* not lint */
/*
@@ -377,6 +377,7 @@ doit(fromp)
* address corresponds to the name.
*/
hostname = saddr;
+ res0 = NULL;
#ifdef KERBEROS
if (!use_kerberos)
#endif
@@ -423,11 +424,12 @@ doit(fromp)
"Host address mismatch for %s\n";
hostname = naddr;
}
- freeaddrinfo(res);
}
}
hostname = strncpy(hostnamebuf, hostname,
sizeof(hostnamebuf) - 1);
+ if (res0)
+ freeaddrinfo(res0);
} else
errorhost = hostname = strncpy(hostnamebuf,
naddr, sizeof(hostnamebuf) - 1);