From 0f21e0bc198af106421b02275a053c82a2eded3d Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 15 Sep 2016 09:43:01 +0200 Subject: QDBusDemarshaller: use RAII in duplicate() QtDBus is compiled with exceptions disabled, but checkers don't know that, and it's not 100% certain it will stay that way until eternity. So do the simple change and hold the new'ed pointer in a QScopedPointer until handing it off to create(). Coverity-Id: 154477 Change-Id: I91a763ca4e93585c97cb9e794312b53046971161 Reviewed-by: Thiago Macieira --- src/dbus/qdbusdemarshaller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/dbus/qdbusdemarshaller.cpp') diff --git a/src/dbus/qdbusdemarshaller.cpp b/src/dbus/qdbusdemarshaller.cpp index cf631baa4f..3852e53d57 100644 --- a/src/dbus/qdbusdemarshaller.cpp +++ b/src/dbus/qdbusdemarshaller.cpp @@ -33,6 +33,9 @@ #include "qdbusargument_p.h" #include "qdbusconnection.h" + +#include + #include QT_BEGIN_NAMESPACE @@ -417,12 +420,12 @@ QDBusDemarshaller *QDBusDemarshaller::endCommon() QDBusArgument QDBusDemarshaller::duplicate() { - QDBusDemarshaller *d = new QDBusDemarshaller(capabilities); + QScopedPointer d(new QDBusDemarshaller(capabilities)); d->iterator = iterator; d->message = q_dbus_message_ref(message); q_dbus_message_iter_next(&iterator); - return QDBusArgumentPrivate::create(d); + return QDBusArgumentPrivate::create(d.take()); } QT_END_NAMESPACE -- cgit v1.2.3