diff options
Diffstat (limited to 'lib/softoken/kbkdf.c')
-rw-r--r-- | lib/softoken/kbkdf.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/softoken/kbkdf.c b/lib/softoken/kbkdf.c index b4544c432..57cce7017 100644 --- a/lib/softoken/kbkdf.c +++ b/lib/softoken/kbkdf.c @@ -613,6 +613,10 @@ kbkdf_CreateKey(CK_MECHANISM_TYPE kdf_mech, CK_SESSION_HANDLE hSession, CK_DERIV PR_ASSERT(derived_key != NULL); PR_ASSERT(derived_key->phKey != NULL); + if (slot == NULL) { + return CKR_SESSION_HANDLE_INVALID; + } + /* Create the new key object for this additional derived key. */ key = sftk_NewObject(slot); if (key == NULL) { @@ -678,7 +682,9 @@ done: sftk_FreeObject(key); /* Doesn't do anything. */ - sftk_FreeSession(session); + if (session) { + sftk_FreeSession(session); + } return ret; } |