summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-11-19 10:20:18 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2020-11-20 14:49:27 +0100
commit16f4ce89eda53645a412b73e0c5ea63e638e7268 (patch)
tree9f5265e17ae8802663e510e92bdac21ba4037126 /src/network
parent1d7189f5b3eb03e7c71fb31e2bd491d0e5a535e4 (diff)
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 <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qdtls_openssl.cpp14
1 files changed, 1 insertions, 13 deletions
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<BIO>.
-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<BIO, dtlsutil::bio_deleter> 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);