Bugzilla bug 135052: more cleanup in SEC_PKCS12DecoderStart. r=relyea.
authorwtc%netscape.com
Fri, 10 May 2002 23:10:06 +0000
changeset 3125 b6f5eaf303c5f96f67482fbec8c814ba8c1191dd
parent 3124 5755c8d81e060ffdd0d9e41eb032f390a2074233
child 3126 efa36b3344c7affaf92bb7f29e7887e7fca3598b
push idunknown
push userunknown
push dateunknown
reviewersrelyea
bugs135052
Bugzilla bug 135052: more cleanup in SEC_PKCS12DecoderStart. r=relyea.
security/nss/lib/pkcs12/p12d.c
--- a/security/nss/lib/pkcs12/p12d.c
+++ b/security/nss/lib/pkcs12/p12d.c
@@ -1197,29 +1197,24 @@ SEC_PKCS12DecoderStart(SECItem *pwitem, 
 #ifdef IS_LITTLE_ENDIAN
     p12dcx->swapUnicodeBytes = PR_TRUE;
 #else
     p12dcx->swapUnicodeBytes = PR_FALSE;
 #endif
     p12dcx->errorValue = 0;
     p12dcx->error = PR_FALSE;
 
-    /* a slot is *required */
-    if(!slot) {
-	PORT_SetError(SEC_ERROR_NO_MEMORY);
-	goto loser;
-    }
-
     /* start the decoding of the PFX and set the notify proc
      * for the PFX item.
      */
     p12dcx->pfxDcx = SEC_ASN1DecoderStart(p12dcx->arena, &p12dcx->pfx,
     					  sec_PKCS12PFXItemTemplate);
     if(!p12dcx->pfxDcx) {
 	PORT_SetError(SEC_ERROR_NO_MEMORY); 
+	PK11_FreeSlot(p12dcx->slot);
 	goto loser;
     }
 
     SEC_ASN1DecoderSetNotifyProc(p12dcx->pfxDcx, 
 				 sec_pkcs12_decoder_pfx_notify_proc,
     				 p12dcx); 
     
     /* set up digest functions */