From 16f4ce89eda53645a412b73e0c5ea63e638e7268 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 19 Nov 2020 10:20:18 +0100 Subject: QDtls - remove redundant RAII struct As noted by LCOV, the part with q_BIO_free(bio) was never executed since we were taking the result from QScopedPointer before returning. While it's a what RAII idiom is for, there is quite a low probability that SSL_set_bio() one day will start throwing exceptions. Pick-to: 6.0 Pick-to: 5.15 Change-Id: Id24e480dac34166c627b71bb2972de558c644339 Reviewed-by: Timur Pocheptsov --- src/network/ssl/qdtls_openssl.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'src/network') diff --git a/src/network/ssl/qdtls_openssl.cpp b/src/network/ssl/qdtls_openssl.cpp index c5891390a7..3f04ab97cd 100644 --- a/src/network/ssl/qdtls_openssl.cpp +++ b/src/network/ssl/qdtls_openssl.cpp @@ -170,16 +170,6 @@ void delete_bio_method(BIO_METHOD *method) q_BIO_meth_free(method); } -// The 'deleter' for QScopedPointer. -struct bio_deleter -{ - static void cleanup(BIO *bio) - { - if (bio) - q_BIO_free(bio); - } -}; - // The path MTU discovery is non-trivial: it's a mix of getsockopt/setsockopt // (IP_MTU/IP6_MTU/IP_MTU_DISCOVER) and fallback MTU values. It's not // supported on all platforms, worse so - imposes specific requirements on @@ -746,8 +736,7 @@ bool DtlsState::initBIO(QDtlsBasePrivate *dtlsBase) q_BIO_meth_set_puts(biom, dtlsbio::q_dgram_puts); q_BIO_meth_set_ctrl(biom, dtlsbio::q_dgram_ctrl); - QScopedPointer newBio(q_BIO_new(biom)); - BIO *bio = newBio.data(); + BIO *bio = q_BIO_new(biom); if (!bio) { dtlsBase->setDtlsError(QDtlsError::TlsInitializationError, msgFunctionFailed("BIO_new")); @@ -755,7 +744,6 @@ bool DtlsState::initBIO(QDtlsBasePrivate *dtlsBase) } q_SSL_set_bio(tlsConnection.data(), bio, bio); - newBio.take(); bioMethod.swap(customMethod); -- cgit v1.2.3