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>
This commit is contained in:
parent
a1be4de712
commit
2eae1ad0ea
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user