diff --git a/tqdbusconnection.cpp b/tqdbusconnection.cpp index a62735e..0360456 100644 --- a/tqdbusconnection.cpp +++ b/tqdbusconnection.cpp @@ -280,8 +280,8 @@ TQT_DBusMessage TQT_DBusConnection::sendWithReply(const TQT_DBusMessage &message DBusMessage *msg = message.toDBusMessage(); if (!msg) return TQT_DBusMessage::fromDBusMessage(0); - DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg, - -1, &d->error); + + DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg, -1, &d->error); if (d->handleError() && error) *error = d->lastError; @@ -289,6 +289,9 @@ TQT_DBusMessage TQT_DBusConnection::sendWithReply(const TQT_DBusMessage &message dbus_message_unref(msg); TQT_DBusMessage ret = TQT_DBusMessage::fromDBusMessage(reply); + if (reply) { + dbus_message_unref(reply); + } bool dbus_error_set = dbus_error_is_set(&d->error); ret.d->error.setDBUSError(dbus_error_set);