Blame SOURCES/nss-3.44-kbkdf-coverity.patch

cae166
diff -up ./lib/softoken/kbkdf.c.coverity ./lib/softoken/kbkdf.c
cae166
--- ./lib/softoken/kbkdf.c.coverity	2019-12-03 15:33:43.047732312 -0800
cae166
+++ ./lib/softoken/kbkdf.c	2019-12-03 15:39:40.982578357 -0800
cae166
@@ -534,6 +534,10 @@ CK_RV kbkdf_CreateKey(CK_SESSION_HANDLE
cae166
     PR_ASSERT(derived_key != NULL);
cae166
     PR_ASSERT(derived_key->phKey != NULL);
cae166
 
cae166
+    if (slot == NULL) {
cae166
+        return CKR_SESSION_HANDLE_INVALID;
cae166
+    }
cae166
+
cae166
     /* Create the new key object for this additional derived key. */
cae166
     key = sftk_NewObject(slot);
cae166
     if (key == NULL) {
cae166
@@ -589,7 +593,9 @@ done:
cae166
     sftk_FreeObject(key);
cae166
 
cae166
     /* Doesn't do anything. */
cae166
-    sftk_FreeSession(session);
cae166
+    if (session) {
cae166
+        sftk_FreeSession(session);
cae166
+    }
cae166
 
cae166
     return ret;
cae166
 }
cae166
diff -up ./lib/softoken/sftkhmac.c.coverity ./lib/softoken/sftkhmac.c
cae166
--- ./lib/softoken/sftkhmac.c.coverity	2019-12-03 15:40:06.108848341 -0800
cae166
+++ ./lib/softoken/sftkhmac.c	2019-12-03 15:41:04.919480267 -0800
cae166
@@ -232,7 +232,9 @@ sftk_MAC_Init(sftk_MACCtx *ctx, CK_MECHA
cae166
                            keyval->attrib.ulValueLen, isFIPS);
cae166
 
cae166
 done:
cae166
-    sftk_FreeAttribute(keyval);
cae166
+    if (keyval) {
cae166
+        sftk_FreeAttribute(keyval);
cae166
+    }
cae166
     return ret;
cae166
 }
cae166