diff options
author | 2004-11-19 10:11:52 +0000 | |
---|---|---|
committer | 2004-11-19 10:11:52 +0000 | |
commit | dcc7e3146a79af97848cfb053b18c260aed81b0a (patch) | |
tree | 0f5b9cf0fbe3cdc382273098d8fa0c88ab00124d /sys/net | |
parent | Add NO_PEER to the list of well-known communities and use 65535 instead of (diff) | |
download | wireguard-openbsd-dcc7e3146a79af97848cfb053b18c260aed81b0a.tar.xz wireguard-openbsd-dcc7e3146a79af97848cfb053b18c260aed81b0a.zip |
Plug memory leak. Found by pat@. Thanks!
ok myself markus@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/pfkeyv2.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index bb697773283..136d75c7994 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.92 2004/08/10 16:17:05 ho Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.93 2004/11/19 10:11:52 hshoexer Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -950,8 +950,11 @@ pfkeyv2_send(struct socket *socket, void *message, int len) newsa->tdb_satype = smsg->sadb_msg_satype; if ((rval = pfkeyv2_get_proto_alg(newsa->tdb_satype, - &newsa->tdb_sproto, &alg))) + &newsa->tdb_sproto, &alg))) { + tdb_free(freeme); + freeme = NULL; goto splxret; + } /* Initialize SA */ import_sa(newsa, headers[SADB_EXT_SA], &ii); @@ -1004,7 +1007,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len) rval = tdb_init(newsa, alg, &ii); if (rval) { rval = EINVAL; - tdb_delete(freeme); + tdb_free(freeme); freeme = NULL; goto splxret; } @@ -1102,8 +1105,11 @@ pfkeyv2_send(struct socket *socket, void *message, int len) newsa->tdb_satype = smsg->sadb_msg_satype; if ((rval = pfkeyv2_get_proto_alg(newsa->tdb_satype, - &newsa->tdb_sproto, &alg))) + &newsa->tdb_sproto, &alg))) { + tdb_free(freeme); + freeme = NULL; goto splxret; + } import_sa(newsa, headers[SADB_EXT_SA], &ii); import_address((struct sockaddr *) &newsa->tdb_src, @@ -1159,7 +1165,7 @@ pfkeyv2_send(struct socket *socket, void *message, int len) rval = tdb_init(newsa, alg, &ii); if (rval) { rval = EINVAL; - tdb_delete(freeme); + tdb_free(freeme); freeme = NULL; goto splxret; } |