plug xform memory leaks:
o add missing zeroize op when deleting an SA o don't re-initialize an xform for an SA that already has one Submitted by: Doug Ambrisko <ambrisko@verniernetworks.com> MFC after: 1 day
This commit is contained in:
parent
72dbc3588c
commit
df5d2376fb
@ -1922,6 +1922,8 @@ xform_init(struct secasvar *sav, int xftype)
|
||||
{
|
||||
struct xformsw *xsp;
|
||||
|
||||
if (sav->tdb_xform != NULL) /* previously initialized */
|
||||
return 0;
|
||||
for (xsp = xforms; xsp; xsp = xsp->xf_next)
|
||||
if (xsp->xf_type == xftype)
|
||||
return (*xsp->xf_init)(sav, xsp);
|
||||
|
@ -2751,13 +2751,24 @@ key_delsav(sav)
|
||||
if (__LIST_CHAINED(sav))
|
||||
LIST_REMOVE(sav, chain);
|
||||
|
||||
/*
|
||||
* Cleanup xform state. Note that zeroize'ing causes the
|
||||
* keys to be cleared; otherwise we must do it ourself.
|
||||
*/
|
||||
if (sav->tdb_xform != NULL) {
|
||||
sav->tdb_xform->xf_zeroize(sav);
|
||||
sav->tdb_xform = NULL;
|
||||
} else {
|
||||
if (sav->key_auth != NULL)
|
||||
bzero(_KEYBUF(sav->key_auth), _KEYLEN(sav->key_auth));
|
||||
if (sav->key_enc != NULL)
|
||||
bzero(_KEYBUF(sav->key_enc), _KEYLEN(sav->key_enc));
|
||||
}
|
||||
if (sav->key_auth != NULL) {
|
||||
bzero(_KEYBUF(sav->key_auth), _KEYLEN(sav->key_auth));
|
||||
KFREE(sav->key_auth);
|
||||
sav->key_auth = NULL;
|
||||
}
|
||||
if (sav->key_enc != NULL) {
|
||||
bzero(_KEYBUF(sav->key_enc), _KEYLEN(sav->key_enc));
|
||||
KFREE(sav->key_enc);
|
||||
sav->key_enc = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user