Fix a memleak in key_spdget.

Problem was reported by Karl Knutsson by pr/36119.
This commit is contained in:
degroote 2007-04-09 21:07:03 +00:00
parent 81cd3e0214
commit 0c3809d098

View File

@ -1,4 +1,4 @@
/* $NetBSD: key.c,v 1.43 2007/03/21 22:38:34 degroote Exp $ */
/* $NetBSD: key.c,v 1.44 2007/04/09 21:07:03 degroote Exp $ */
/* $FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.43 2007/03/21 22:38:34 degroote Exp $");
__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.44 2007/04/09 21:07:03 degroote Exp $");
/*
* This code is referd to RFC 2367
@ -2263,6 +2263,7 @@ key_spdget(so, m, mhp)
}
n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid);
KEY_FREESP(&sp); /* ref gained by key_getspbyid */
if (n != NULL) {
m_freem(m);
return key_sendup_mbuf(so, n, KEY_SENDUP_ONE);