diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2020-11-19 10:20:18 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-11-20 18:04:55 +0000 |
commit | 88e928aac22bee94d46f7c054b0ea8cbcb577f29 (patch) | |
tree | c0c3e3640befa0a529589d60fd24f2787654b7e4 /src/network | |
parent | ca979fd84461c1ec4bf232d6c4684261a9d55d4f (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.
Change-Id: Id24e480dac34166c627b71bb2972de558c644339
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 16f4ce89eda53645a412b73e0c5ea63e638e7268)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/ssl/qdtls_openssl.cpp | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/network/ssl/qdtls_openssl.cpp b/src/network/ssl/qdtls_openssl.cpp index 25a6c5f49c..ede9595f19 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); |