[network/ruqola] src/core/encryption: Fix mem leak
Laurent Montel <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 6dad52537d545ebe4f82d6757df8358652a87a04 by Laurent Montel.
Committed on 17/08/2026 at 11:38.
Pushed by mlaurent into branch 'master'.
Fix mem leak
M +3 -0 src/core/encryption/encryptionutils.cpp
https://invent.kde.org/network/ruqola/-/commit/6dad52537d545ebe4f82d6757df8358652a87a04
diff --git a/src/core/encryption/encryptionutils.cpp b/src/core/encryption/encryptionutils.cpp
index f582c51fd2..dad8c10fd5 100644
--- a/src/core/encryption/encryptionutils.cpp
+++ b/src/core/encryption/encryptionutils.cpp
@@ -211,6 +211,7 @@ EncryptionUtils::RSAKeyPair EncryptionUtils::generateRSAKey()
ret = BN_set_word(bne, e);
if (ret != 1) {
qCWarning(RUQOLA_ENCRYPTION_LOG) << "Error when generating exponent";
+ BN_free(bne);
return {};
}
@@ -218,6 +219,8 @@ EncryptionUtils::RSAKeyPair EncryptionUtils::generateRSAKey()
ret = RSA_generate_key_ex(rsa, bits, bne, nullptr);
if (ret != 1) {
qCWarning(RUQOLA_ENCRYPTION_LOG) << "Error during generate key";
+ BN_free(bne);
+ RSA_free(rsa);
return {};
}