From 89be80257477233dbda99a22d5afb560898b513e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 30 Jan 2014 02:31:39 +0100 Subject: Fix duplication UnixFD during demarshall Fix uninitialized UnixFD private data --- tqdbusmarshall.cpp | 7 +++++-- tqdbusunixfd.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tqdbusmarshall.cpp b/tqdbusmarshall.cpp index f4aa5f7..7c21619 100644 --- a/tqdbusmarshall.cpp +++ b/tqdbusmarshall.cpp @@ -599,8 +599,11 @@ static TQT_DBusData qFetchParameter(DBusMessageIter *it) return TQT_DBusData::fromStruct(memberList); } - case DBUS_TYPE_UNIX_FD: - return TQT_DBusData::fromUnixFd(TQT_DBusUnixFd(qIterGet(it))); + case DBUS_TYPE_UNIX_FD: { + TQT_DBusUnixFd unixFd; + unixFd.giveFileDescriptor(qIterGet(it)); + return TQT_DBusData::fromUnixFd(unixFd); + } #if 0 case DBUS_TYPE_INVALID: // TODO: check if there is better way to detect empty arrays diff --git a/tqdbusunixfd.cpp b/tqdbusunixfd.cpp index ba7a06c..3aa4ba2 100644 --- a/tqdbusunixfd.cpp +++ b/tqdbusunixfd.cpp @@ -35,7 +35,7 @@ TQT_DBusUnixFd::TQT_DBusUnixFd(const TQT_DBusUnixFd& other) : d(other.d) d->ref(); } -TQT_DBusUnixFd::TQT_DBusUnixFd(int other) +TQT_DBusUnixFd::TQT_DBusUnixFd(int other) : d(0) { setFileDescriptor(other); } -- cgit v1.2.1