summaryrefslogtreecommitdiff
path: root/sys/netinet6/nd6.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2016-08-22 10:33:23 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2016-08-22 10:33:23 +0000
commit1fd9a929e6d2ad9f4ee609809ba4ffcdb53011a4 (patch)
treea6461a976d05ce192b585855bd2a13189e13f6c1 /sys/netinet6/nd6.c
parent43b309c717d69973637c2f73a3c7e12a6b2c78ab (diff)
Sizes for free(9) from David Hill.
Diffstat (limited to 'sys/netinet6/nd6.c')
-rw-r--r--sys/netinet6/nd6.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c
index b523d4a08c8..66676cc879b 100644
--- a/sys/netinet6/nd6.c
+++ b/sys/netinet6/nd6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nd6.c,v 1.188 2016/07/13 08:40:46 mpi Exp $ */
+/* $OpenBSD: nd6.c,v 1.189 2016/08/22 10:33:22 mpi Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
@@ -153,7 +153,7 @@ void
nd6_ifdetach(struct nd_ifinfo *nd)
{
- free(nd, M_IP6NDP, 0);
+ free(nd, M_IP6NDP, sizeof(*nd));
}
void
@@ -1634,7 +1634,7 @@ nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
ol = oldlenp ? *oldlenp : 0;
if (oldp) {
- p = malloc(*oldlenp, M_TEMP, M_WAITOK | M_CANFAIL);
+ p = malloc(ol, M_TEMP, M_WAITOK | M_CANFAIL);
if (!p)
return ENOMEM;
} else
@@ -1656,8 +1656,7 @@ nd6_sysctl(int name, void *oldp, size_t *oldlenp, void *newp, size_t newlen)
error = ENOPROTOOPT;
break;
}
- if (p)
- free(p, M_TEMP, 0);
+ free(p, M_TEMP, ol);
return (error);
}