certDBEntrySubject *entry;
certDBEntrySubject *entry = NULL;
UpdateSubjectWithEmailAddr(NSSLOWCERTCertDBHandle *dbhandle, 					SECItem *derSubject, char *emailAddr){    PRBool save = PR_FALSE, delold = PR_FALSE;    certDBEntrySubject *entry;    SECStatus rv;       if (emailAddr) { 	emailAddr = nsslowcert_FixupEmailAddr(emailAddr);	if (emailAddr == NULL) {	    return SECFailure;	}    }    entry = ReadDBSubjectEntry(dbhandle,derSubject);            if ( entry->emailAddr ) {	if ( (emailAddr == NULL) || 		(PORT_Strcmp(entry->emailAddr, emailAddr) != 0) ) {	    save = PR_TRUE;	    delold = PR_TRUE;	}    } else if (emailAddr) {	save = PR_TRUE;    }    if ( delold ) {	/* delete the old smime entry, because this cert now has a new	 * smime entry pointing to it	 */	PORT_Assert(save);	PORT_Assert(entry->emailAddr != NULL);	DeleteDBSMimeEntry(dbhandle, entry->emailAddr);    }    if ( save ) {	unsigned int len;		PORT_Assert(entry != NULL);	if (emailAddr) {	    len = PORT_Strlen(emailAddr) + 1;	    entry->emailAddr = (char *)PORT_ArenaAlloc(entry->common.arena, len);	    if ( entry->emailAddr == NULL ) {		goto loser;	    }	    PORT_Memcpy(entry->emailAddr, emailAddr, len);	} else {	    entry->emailAddr = NULL;	}		/* delete the subject entry */	DeleteDBSubjectEntry(dbhandle, derSubject);	/* write the new one */	rv = WriteDBSubjectEntry(dbhandle, entry);	if ( rv != SECSuccess ) {	    goto loser;	}    }    if (emailAddr) PORT_Free(emailAddr);    return(SECSuccess);loser:    if (emailAddr) PORT_Free(emailAddr);    return(SECFailure);}