fix: remove unneeded EVP_PKEY_new() (causes memory leak)
This commit is contained in:
parent
051464e7fd
commit
53903016b1
1 changed files with 2 additions and 4 deletions
|
|
@ -66,14 +66,12 @@ void generatePemSelfSignedCert(const QString &path, int keyLength)
|
|||
{
|
||||
auto expirationDays = 365;
|
||||
|
||||
auto *privateKey = EVP_PKEY_new();
|
||||
auto *privateKey = EVP_RSA_gen(keyLength);
|
||||
if (!privateKey) {
|
||||
throw std::runtime_error("could not allocate private key for certificate");
|
||||
throw std::runtime_error("failed to generate a " + std::to_string(keyLength) + "bit key for certificate");
|
||||
}
|
||||
auto privateKeyFree = finally([privateKey]() { EVP_PKEY_free(privateKey); });
|
||||
|
||||
privateKey = EVP_RSA_gen(keyLength);
|
||||
|
||||
auto *cert = X509_new();
|
||||
if (!cert) {
|
||||
throw std::runtime_error("could not allocate certificate");
|
||||
|
|
|
|||
Loading…
Reference in a new issue