Bug 486404 Various XPCOM allocator mismatches in PSM r=mayhemer
This commit is contained in:
Родитель
a7577ac967
Коммит
869d191bac
|
@ -428,7 +428,9 @@ GetCertFingerprintByOidTag(CERTCertificate* nsscert,
|
|||
fpItem.data = (unsigned char*)fingerprint->Data();
|
||||
fpItem.len = hash_len;
|
||||
|
||||
fp.Adopt(CERT_Hexify(&fpItem, 1));
|
||||
char *tmpstr = CERT_Hexify(&fpItem, 1);
|
||||
fp.Assign(tmpstr);
|
||||
PORT_Free(tmpstr);
|
||||
fingerprint->Release();
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -944,9 +944,10 @@ void PR_CALLBACK HandshakeCallback(PRFileDesc* fd, void* client_data) {
|
|||
status->mHaveKeyLengthAndCipher = PR_TRUE;
|
||||
status->mKeyLength = keyLength;
|
||||
status->mSecretKeyLength = encryptBits;
|
||||
status->mCipherName.Adopt(cipherName);
|
||||
status->mCipherName.Assign(cipherName);
|
||||
}
|
||||
|
||||
PORT_Free(cipherName);
|
||||
PR_FREEIF(certOrgName);
|
||||
PR_Free(signer);
|
||||
}
|
||||
|
|
|
@ -984,9 +984,10 @@ nsNSSCertificate::GetSerialNumber(nsAString &_serialNumber)
|
|||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
_serialNumber.Truncate();
|
||||
nsXPIDLCString tmpstr; tmpstr.Adopt(CERT_Hexify(&mCert->serialNumber, 1));
|
||||
if (tmpstr.get()) {
|
||||
char *tmpstr = CERT_Hexify(&mCert->serialNumber, 1);
|
||||
if (tmpstr) {
|
||||
_serialNumber = NS_ConvertASCIItoUTF16(tmpstr);
|
||||
PORT_Free(tmpstr);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1007,9 +1008,10 @@ nsNSSCertificate::GetSha1Fingerprint(nsAString &_sha1Fingerprint)
|
|||
mCert->derCert.data, mCert->derCert.len);
|
||||
fpItem.data = fingerprint;
|
||||
fpItem.len = SHA1_LENGTH;
|
||||
nsXPIDLCString fpStr; fpStr.Adopt(CERT_Hexify(&fpItem, 1));
|
||||
if (fpStr.get()) {
|
||||
char *fpStr = CERT_Hexify(&fpItem, 1);
|
||||
if (fpStr) {
|
||||
_sha1Fingerprint = NS_ConvertASCIItoUTF16(fpStr);
|
||||
PORT_Free(fpStr);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1030,9 +1032,10 @@ nsNSSCertificate::GetMd5Fingerprint(nsAString &_md5Fingerprint)
|
|||
mCert->derCert.data, mCert->derCert.len);
|
||||
fpItem.data = fingerprint;
|
||||
fpItem.len = MD5_LENGTH;
|
||||
nsXPIDLCString fpStr; fpStr.Adopt(CERT_Hexify(&fpItem, 1));
|
||||
if (fpStr.get()) {
|
||||
char *fpStr = CERT_Hexify(&fpItem, 1);
|
||||
if (fpStr) {
|
||||
_md5Fingerprint = NS_ConvertASCIItoUTF16(fpStr);
|
||||
PORT_Free(fpStr);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -108,7 +108,8 @@
|
|||
//file.
|
||||
|
||||
NSSCleanupAutoPtrClass(CERTCertificate, CERT_DestroyCertificate)
|
||||
NSSCleanupAutoPtrClass(char, PR_FREEIF)
|
||||
NSSCleanupAutoPtrClass(char, PL_strfree)
|
||||
NSSCleanupAutoPtrClass(void, PR_FREEIF)
|
||||
NSSCleanupAutoPtrClass_WithParam(PRArenaPool, PORT_FreeArena, FalseParam, PR_FALSE)
|
||||
|
||||
/* SSM_UserCertChoice: enum for cert choice info */
|
||||
|
@ -265,14 +266,14 @@ nsNSSSocketInfo::SetHandshakePending(PRBool aHandshakePending)
|
|||
nsresult
|
||||
nsNSSSocketInfo::SetHostName(const char* host)
|
||||
{
|
||||
mHostName.Adopt(host ? nsCRT::strdup(host) : 0);
|
||||
mHostName.Adopt(host ? NS_strdup(host) : 0);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNSSSocketInfo::GetHostName(char **host)
|
||||
{
|
||||
*host = (mHostName) ? nsCRT::strdup(mHostName) : nsnull;
|
||||
*host = (mHostName) ? NS_strdup(mHostName) : nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2712,7 +2713,8 @@ SECStatus nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket,
|
|||
|
||||
/* Get CN and O of the subject and O of the issuer */
|
||||
char *ccn = CERT_GetCommonName(&serverCert->subject);
|
||||
charCleaner ccnCleaner(ccn);
|
||||
void *v = ccn;
|
||||
voidCleaner ccnCleaner(v);
|
||||
NS_ConvertUTF8toUTF16 cn(ccn);
|
||||
|
||||
PRInt32 port;
|
||||
|
|
|
@ -241,7 +241,7 @@ EncryptString(const char *text, char **_retval)
|
|||
rv = encode(encrypted, eLen, _retval);
|
||||
|
||||
loser:
|
||||
if (encrypted) nsMemory::Free(encrypted);
|
||||
if (encrypted) PORT_Free(encrypted);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -280,8 +280,8 @@ DecryptString(const char *crypt, char **_retval)
|
|||
r = 0;
|
||||
|
||||
loser:
|
||||
if (decrypted) nsMemory::Free(decrypted);
|
||||
if (decoded) nsMemory::Free(decoded);
|
||||
if (decrypted) PORT_Free(decrypted);
|
||||
if (decoded) PR_DELETE(decoded);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -378,7 +378,11 @@ encode(const unsigned char *data, PRInt32 dataLen, char **_retval)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
*_retval = PL_Base64Encode((const char *)data, dataLen, NULL);
|
||||
char *result = PL_Base64Encode((const char *)data, dataLen, NULL);
|
||||
if (!result) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
*_retval = NS_strdup(result);
|
||||
PR_DELETE(result);
|
||||
if (!*_retval) { rv = NS_ERROR_OUT_OF_MEMORY; goto loser; }
|
||||
|
||||
loser:
|
||||
|
|
|
@ -86,7 +86,7 @@ nsSSLStatus::GetCipherName(char** _result)
|
|||
if (!mHaveKeyLengthAndCipher)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
*_result = PL_strdup(mCipherName.get());
|
||||
*_result = ToNewCString(mCipherName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче