mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
bug 1205767 - prevent memory leak when generating an EC key with <keygen> r=ttaubert
This commit is contained in:
parent
acdd60dddc
commit
a81ffd22d7
@ -481,7 +481,7 @@ nsKeygenFormProcessor::GetPublicKey(const nsAString& aValue,
|
||||
PK11RSAGenParams rsaParams;
|
||||
SECOidTag algTag;
|
||||
int keysize = 0;
|
||||
void *params;
|
||||
void *params = nullptr;
|
||||
SECKEYPrivateKey *privateKey = nullptr;
|
||||
SECKEYPublicKey *publicKey = nullptr;
|
||||
CERTSubjectPublicKeyInfo *spkInfo = nullptr;
|
||||
@ -766,6 +766,12 @@ loser:
|
||||
if (pkac.challenge.data) {
|
||||
free(pkac.challenge.data);
|
||||
}
|
||||
// If params is non-null and doesn't point to rsaParams, it was allocated
|
||||
// in decode_ec_params. We have to free this memory.
|
||||
if (params && params != &rsaParams) {
|
||||
SECITEM_FreeItem(static_cast<SECItem*>(params), true);
|
||||
params = nullptr;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user