PK11SlotInfo *slot = NULL;
sec_pkcs12_remove_existing_cert(sec_PKCS12SafeBag *cert, 				void *wincx){    SECItem *derCert = NULL;    CERTCertificate *tempCert = NULL;    CK_OBJECT_HANDLE certObj;    PK11SlotInfo *slot = NULL;    PRBool removed = PR_FALSE;    if(!cert) {	return SECFailure;    }    PORT_Assert(cert->removeExisting);    cert->removeExisting = PR_FALSE;    derCert = &cert->safeBagContent.certBag->value.x509Cert;    tempCert = CERT_NewTempCertificate(CERT_GetDefaultCertDB(), derCert,				       NULL, PR_FALSE, PR_TRUE);    if(!tempCert) {	return SECFailure;    }    certObj = PK11_FindCertInSlot(cert->slot, tempCert, wincx);    CERT_DestroyCertificate(tempCert);    tempCert = NULL;    if(certObj != CK_INVALID_KEY) {	PK11_DestroyObject(cert->slot, certObj);	removed = PR_TRUE;    } else if(PK11_IsInternal(cert->slot)) {	tempCert = CERT_FindCertByDERCert(CERT_GetDefaultCertDB(), derCert);	if(tempCert) {	    if(SEC_DeletePermCertificate(tempCert) == SECSuccess) {		removed = PR_TRUE;	    } 	    CERT_DestroyCertificate(tempCert);	    tempCert = NULL;	}    }    if(!removed) {	cert->problem = PR_TRUE;	cert->error = SEC_ERROR_NO_MEMORY;	cert->noInstall = PR_TRUE;    }	    if(tempCert) {	CERT_DestroyCertificate(tempCert);    }    return ((removed) ? SECSuccess : SECFailure);}