Skip to content

Commit

Permalink
Merge PR #6604: FIX(client): Fix memory leaks due to BIO_NOCLOSE flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Krzmbrzl authored Jan 13, 2025
2 parents ba3a32d + 1fcb27f commit 66e202f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/mumble/Cert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,7 @@ Settings::KeyPair CertWizard::importCert(QByteArray data, const QString &pw) {
Settings::KeyPair kp;
int ret = 0;

mem = BIO_new_mem_buf(data.data(), static_cast< int >(data.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
mem = BIO_new_mem_buf(data.data(), static_cast< int >(data.size()));
pkcs = d2i_PKCS12_bio(mem, nullptr);
if (pkcs) {
ret = PKCS12_parse(pkcs, nullptr, &pkey, &x509, &certs);
Expand Down
6 changes: 2 additions & 4 deletions src/murmur/Cert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ bool Server::isKeyForCert(const QSslKey &key, const QSslCertificate &cert) {
EVP_PKEY *pkey = nullptr;
BIO *mem = nullptr;

mem = BIO_new_mem_buf(qbaKey.data(), static_cast< int >(qbaKey.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
mem = BIO_new_mem_buf(qbaKey.data(), static_cast< int >(qbaKey.size()));
pkey = d2i_PrivateKey_bio(mem, nullptr);
BIO_free(mem);

mem = BIO_new_mem_buf(qbaCert.data(), static_cast< int >(qbaCert.size()));
Q_UNUSED(BIO_set_close(mem, BIO_NOCLOSE));
mem = BIO_new_mem_buf(qbaCert.data(), static_cast< int >(qbaCert.size()));
x509 = d2i_X509_bio(mem, nullptr);
BIO_free(mem);
mem = nullptr;
Expand Down

0 comments on commit 66e202f

Please sign in to comment.