diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-09-15 09:43:01 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-10-06 16:39:01 +0000 |
commit | 0f21e0bc198af106421b02275a053c82a2eded3d (patch) | |
tree | e515a6adabdca3278827ff2327661009e85bb393 /src/dbus/qdbusdemarshaller.cpp | |
parent | 0bf0c3e184448e91a7ddbd20b03997538ae19f41 (diff) |
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 <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusdemarshaller.cpp')
-rw-r--r-- | src/dbus/qdbusdemarshaller.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
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 <qscopedpointer.h> + #include <stdlib.h> QT_BEGIN_NAMESPACE @@ -417,12 +420,12 @@ QDBusDemarshaller *QDBusDemarshaller::endCommon() QDBusArgument QDBusDemarshaller::duplicate() { - QDBusDemarshaller *d = new QDBusDemarshaller(capabilities); + QScopedPointer<QDBusDemarshaller> 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 |