summaryrefslogtreecommitdiff
path: root/sys/net/pfkeyv2.c
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2020-07-15 11:56:30 +0000
committerkn <kn@cvs.openbsd.org>2020-07-15 11:56:30 +0000
commit475b288d544e4c7de1dd04e7cbb1e1f19b4438fb (patch)
treea1097dcd6b079010c06810d92430f3e50f200ad9 /sys/net/pfkeyv2.c
parentc76181738a2a65481c6c32f004dc4d0965f49e09 (diff)
Add sizes to free(9) calls
All of these buffers are cleared with explicit sizes before free(), so reuse the given sizes. tested and OK tobhe
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r--sys/net/pfkeyv2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 7ce2f0da201..71bbac1f5e6 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.200 2020/04/23 19:38:08 tobhe Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.201 2020/07/15 11:56:29 kn Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -634,7 +634,7 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so,
ret:
if (buffer != NULL) {
bzero(buffer, j + sizeof(struct sadb_msg));
- free(buffer, M_PFKEY, 0);
+ free(buffer, M_PFKEY, j + sizeof(struct sadb_msg));
}
return (rval);
@@ -1179,7 +1179,7 @@ pfkeyv2_send(struct socket *so, void *message, int len)
/* Paranoid */
explicit_bzero(freeme, sizeof(struct sadb_msg) + len);
- free(freeme, M_PFKEY, 0);
+ free(freeme, M_PFKEY, sizeof(struct sadb_msg) + len);
freeme = NULL;
}
@@ -2095,7 +2095,7 @@ realret:
free(freeme3, M_PFKEY, 0);
explicit_bzero(message, len);
- free(message, M_PFKEY, 0);
+ free(message, M_PFKEY, len);
free(sa1, M_PFKEY, 0);
@@ -2306,7 +2306,7 @@ pfkeyv2_acquire(struct ipsec_policy *ipo, union sockaddr_union *gw,
ret:
if (buffer != NULL) {
bzero(buffer, i);
- free(buffer, M_PFKEY, 0);
+ free(buffer, M_PFKEY, i);
}
return (rval);
@@ -2397,7 +2397,7 @@ pfkeyv2_expire(struct tdb *tdb, u_int16_t type)
ret:
if (buffer != NULL) {
bzero(buffer, i);
- free(buffer, M_PFKEY, 0);
+ free(buffer, M_PFKEY, i);
}
return (rval);