summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authordg199075 <none@none>2007-03-17 09:08:32 -0700
committerdg199075 <none@none>2007-03-17 09:08:32 -0700
commitb2a92f83e9a3b1d94fff9ad8836bd0badac3d576 (patch)
treed920e0dc95836cc73f278f4883652bbe8eb1da71 /usr/src
parent7d546a597e96c85ebec5b8244bedb10a423bd2bf (diff)
downloadillumos-joyent-b2a92f83e9a3b1d94fff9ad8836bd0badac3d576.tar.gz
6444270 route(1m) frees an unfreeable buffer
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/cmd-inet/usr.sbin/route.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr/src/cmd/cmd-inet/usr.sbin/route.c b/usr/src/cmd/cmd-inet/usr.sbin/route.c
index e2788c7da9..c2904d4dfe 100644
--- a/usr/src/cmd/cmd-inet/usr.sbin/route.c
+++ b/usr/src/cmd/cmd-inet/usr.sbin/route.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -1039,9 +1039,14 @@ del_rtcmd_irep(rtcmd_irep_t *rcip)
free(rcip->ri_dest_str);
free(rcip->ri_gate_str);
free(rcip->ri_ifp_str);
- if (rcip->ri_gate_hp != NULL) {
+ /*
+ * IPv6 host entries come from getipnodebyname, which dynamically
+ * allocates memory. IPv4 host entries come from gethostbyname, which
+ * returns static memory and cannot be freed with freehostent.
+ */
+ if (rcip->ri_gate_hp != NULL &&
+ rcip->ri_gate_hp->h_addrtype == AF_INET6)
freehostent(rcip->ri_gate_hp);
- }
free(rcip);
}