diff options
author | Hakan Olsson <ho@cvs.openbsd.org> | 1999-05-31 18:57:32 +0000 |
---|---|---|
committer | Hakan Olsson <ho@cvs.openbsd.org> | 1999-05-31 18:57:32 +0000 |
commit | dd7593ebd2f764d56ffd244c427ae3715eeead0b (patch) | |
tree | 1939498c5d72105a019ec3ddc723712d24cec06b /sys/net | |
parent | ae20f0d5454c5de552ea0d713481533148fd9460 (diff) |
Fix M_TEMP memory leak in pfkeyv2_expire()
(likewise future pfkeyv2_acquire())
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pfkeyv2.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index cc99644f8f7..13cbc5f4e6b 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1624,7 +1624,7 @@ pfkeyv2_acquire(void *os) #if 0 int rval = 0; int i, j; - void *p, *headers[SADB_EXT_MAX+1], *buffer; + void *p, *headers[SADB_EXT_MAX+1], *buffer = NULL; if (!nregistered) { rval = ESRCH; @@ -1730,6 +1730,10 @@ pfkeyv2_acquire(void *os) rval = 0; ret: + if (buffer != NULL) { + bzero(buffer, i); + free(buffer, M_TEMP); + } return rval; #endif return 0; @@ -1741,7 +1745,7 @@ pfkeyv2_expire(struct tdb *sa, u_int16_t type) int rval = 0; int i; u_int8_t satype; - void *p, *headers[SADB_EXT_MAX+1], *buffer; + void *p, *headers[SADB_EXT_MAX+1], *buffer = NULL; switch (sa->tdb_sproto) { case IPPROTO_AH: @@ -1803,6 +1807,10 @@ pfkeyv2_expire(struct tdb *sa, u_int16_t type) rval = 0; ret: + if (buffer != NULL) { + bzero(buffer, i); + free(buffer, M_TEMP); + } return rval; } |