summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2019-07-08 17:49:57 +0000
committermpi <mpi@openbsd.org>2019-07-08 17:49:57 +0000
commit05aee34c6b061799e7af7dc130f0e02a34e71b54 (patch)
tree5c562c0155f9a0d660bf04e7d140e1df141e9cef /sys
parentAdd some padding bytes to syscall argument struct so that tests (diff)
downloadwireguard-openbsd-05aee34c6b061799e7af7dc130f0e02a34e71b54.tar.xz
wireguard-openbsd-05aee34c6b061799e7af7dc130f0e02a34e71b54.zip
free(9) sizes for M_RTABLE.
ok kn@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf_table.c6
-rw-r--r--sys/net/radix.c6
-rw-r--r--sys/netinet/ip_spd.c5
3 files changed, 9 insertions, 8 deletions
diff --git a/sys/net/pf_table.c b/sys/net/pf_table.c
index cd84cabf0f3..aa91b250d50 100644
--- a/sys/net/pf_table.c
+++ b/sys/net/pf_table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_table.c,v 1.130 2018/12/10 16:48:15 kn Exp $ */
+/* $OpenBSD: pf_table.c,v 1.131 2019/07/08 17:49:57 mpi Exp $ */
/*
* Copyright (c) 2002 Cedric Berger
@@ -2051,9 +2051,9 @@ pfr_destroy_ktable(struct pfr_ktable *kt, int flushaddr)
pfr_destroy_kentries(&addrq);
}
if (kt->pfrkt_ip4 != NULL)
- free((caddr_t)kt->pfrkt_ip4, M_RTABLE, 0);
+ free(kt->pfrkt_ip4, M_RTABLE, sizeof(*kt->pfrkt_ip4));
if (kt->pfrkt_ip6 != NULL)
- free((caddr_t)kt->pfrkt_ip6, M_RTABLE, 0);
+ free(kt->pfrkt_ip6, M_RTABLE, sizeof(*kt->pfrkt_ip6));
if (kt->pfrkt_shadow != NULL)
pfr_destroy_ktable(kt->pfrkt_shadow, flushaddr);
if (kt->pfrkt_rs != NULL) {
diff --git a/sys/net/radix.c b/sys/net/radix.c
index e7303fbcc9c..563f32e2c80 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix.c,v 1.58 2017/06/20 09:03:39 mpi Exp $ */
+/* $OpenBSD: radix.c,v 1.59 2019/07/08 17:49:57 mpi Exp $ */
/* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */
/*
@@ -448,7 +448,7 @@ rn_addmask(void *n_arg, int search, int skip)
tm = NULL;
if (tm || search)
return (tm);
- tm = malloc(max_keylen + 2 * sizeof (*tm), M_RTABLE, M_NOWAIT | M_ZERO);
+ tm = malloc(max_keylen + 2 * sizeof(*tm), M_RTABLE, M_NOWAIT | M_ZERO);
if (tm == NULL)
return (0);
saved_tm = tm;
@@ -457,7 +457,7 @@ rn_addmask(void *n_arg, int search, int skip)
tm = rn_insert(cp, mask_rnhead, &maskduplicated, tm);
if (maskduplicated) {
log(LOG_ERR, "%s: mask impossibly already in tree\n", __func__);
- free(saved_tm, M_RTABLE, 0);
+ free(saved_tm, M_RTABLE, max_keylen + 2 * sizeof(*saved_tm));
return (tm);
}
/*
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index 076534ac184..f9f17c3a7bd 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.99 2018/10/22 15:32:19 cheloha Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.100 2019/07/08 17:49:57 mpi Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -93,7 +93,8 @@ spd_table_add(unsigned int rtableid)
if (spd_tables != NULL) {
memcpy(p, spd_tables, sizeof(*rnh) * (spd_table_max+1));
- free(spd_tables, M_RTABLE, 0);
+ free(spd_tables, M_RTABLE,
+ sizeof(*rnh) * (spd_table_max+1));
}
spd_tables = p;
spd_table_max = rdomain;