From afe416c4e156247c864a7140c59f825f0914f1b8 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 21 Jun 2021 12:20:01 +0200 Subject: [PATCH] Move tidy-up of private to its own destructor QOCIResult::~QOCIResult() was doing part of the tidy-up for QOCIResultPrivate, whose own destructor took care of the rest. So move that part to the private, where it makes more sense. Also correct an error message in part of the private's existing tidy-up and eliminate a needless local variable. Change-Id: I09a51c72afd7a30bcee7f6127c59d703650f1c41 Reviewed-by: Andy Shaw --- src/plugins/sqldrivers/oci/qsql_oci.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index a3be29cb38..b8743ea04b 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp @@ -1862,9 +1862,11 @@ QOCIResultPrivate::~QOCIResultPrivate() { delete cols; - int r = OCIHandleFree(err, OCI_HTYPE_ERROR); - if (r != 0) + if (sql && OCIHandleFree(sql, OCI_HTYPE_STMT) != OCI_SUCCESS) qWarning("~QOCIResult: unable to free statement handle"); + + if (OCIHandleFree(err, OCI_HTYPE_ERROR) != OCI_SUCCESS) + qWarning("~QOCIResult: unable to free error report handle"); } @@ -1877,12 +1879,6 @@ QOCIResult::QOCIResult(const QOCIDriver *db) QOCIResult::~QOCIResult() { - Q_D(QOCIResult); - if (d->sql) { - int r = OCIHandleFree(d->sql, OCI_HTYPE_STMT); - if (r != 0) - qWarning("~QOCIResult: unable to free statement handle"); - } } QVariant QOCIResult::handle() const