Bug 1376494 - NULL check argument to PK11_FreeSymKey, r=rrelyea
authorMartin Thomson <martin.thomson@gmail.com>
Mon, 21 Aug 2017 16:29:21 +1000
changeset 13537 317881476c6e08be5c1e561c0c032d7b3f40d1c2
parent 13536 f4666e28214bfed32f67d0f8255a22b50f3bc403
child 13538 711b3866b2ce311baa27316c53aeeab6f7980e86
push id2330
push usermartin.thomson@gmail.com
push dateMon, 21 Aug 2017 06:29:41 +0000
reviewersrrelyea
bugs1376494
Bug 1376494 - NULL check argument to PK11_FreeSymKey, r=rrelyea
lib/pk11wrap/pk11skey.c
--- a/lib/pk11wrap/pk11skey.c
+++ b/lib/pk11wrap/pk11skey.c
@@ -177,16 +177,20 @@ pk11_CreateSymKey(PK11SlotInfo *slot, CK
  * destroy a symetric key
  */
 void
 PK11_FreeSymKey(PK11SymKey *symKey)
 {
     PK11SlotInfo *slot;
     PRBool freeit = PR_TRUE;
 
+    if (!symKey) {
+        return;
+    }
+
     if (PR_ATOMIC_DECREMENT(&symKey->refCount) == 0) {
         PK11SymKey *parent = symKey->parent;
 
         symKey->parent = NULL;
         if ((symKey->owner) && symKey->objectID != CK_INVALID_HANDLE) {
             pk11_EnterKeyMonitor(symKey);
             (void)PK11_GETTAB(symKey->slot)->C_DestroyObject(symKey->session, symKey->objectID);
             pk11_ExitKeyMonitor(symKey);