summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rarpd
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1995-03-26 02:37:00 +0000
committerwpaul <wpaul@FreeBSD.org>1995-03-26 02:37:00 +0000
commitdbe9cf220e7d60655b2a99606e1a635b9da007db (patch)
tree3ce2acad7614f2d1a40e98ec8daaf55b9ca4aa79 /usr.sbin/rarpd
parentc149b5ed9b6f13c485e939594e954162de8e2047 (diff)
downloadFreeBSD-src-dbe9cf220e7d60655b2a99606e1a635b9da007db.zip
FreeBSD-src-dbe9cf220e7d60655b2a99606e1a635b9da007db.tar.gz
Make sure we free() the result returned to us by yp_match().
Diffstat (limited to 'usr.sbin/rarpd')
-rw-r--r--usr.sbin/rarpd/ether_addr.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/rarpd/ether_addr.c b/usr.sbin/rarpd/ether_addr.c
index 87d5e70..7404c81 100644
--- a/usr.sbin/rarpd/ether_addr.c
+++ b/usr.sbin/rarpd/ether_addr.c
@@ -10,7 +10,7 @@
*
* Have a party.
*
- * $Id: ether_addr.c,v 1.2 1995/03/03 22:20:15 wpaul Exp $
+ * $Id: ether_addr.c,v 1.4 1995/03/05 22:03:58 wpaul Exp $
*/
@@ -119,13 +119,18 @@ int ether_ntohost(hostname, e)
return(1);
ether_a = ether_ntoa(e);
if (yp_match(yp_domain, "ethers.byaddr", ether_a,
- strlen(ether_a), &result, &resultlen))
+ strlen(ether_a), &result, &resultlen)) {
+ free(result);
return(1);
+ }
if (!ether_line(result, &local_ether, &local_host)) {
strcpy(hostname, (char *)&local_host);
+ free(result);
return(0);
- } else
+ } else {
+ free(result);
return(1);
+ }
}
if (!ether_line(&buf, &local_ether, &local_host)) {
if (!bcmp((char *)&local_ether.octet[0],
@@ -167,14 +172,19 @@ int ether_hostton(hostname, e)
if (yp_get_default_domain(&yp_domain))
return(1);
if (yp_match(yp_domain, "ethers.byname", hostname,
- strlen(hostname), &result, &resultlen))
+ strlen(hostname), &result, &resultlen)) {
+ free(result);
return(1);
+ }
if (!ether_line(result, &local_ether, &local_host)) {
bcopy((char *)&local_ether.octet[0],
(char *)&e->octet[0], 6);
+ free(result);
return(0);
- } else
+ } else {
+ free(result);
return(1);
+ }
}
if (!ether_line(&buf, &local_ether, &local_host)) {
if (!strcmp(hostname, (char *)&local_host)) {
OpenPOWER on IntegriCloud