summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-08-28 17:56:48 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-08-28 17:56:48 -0500
commit4cdf1eafd1d16a70dfb5199ecab0ac2ce46982c8 (patch)
tree0984bee65f384b6b02737670efde9905f576e132
parente8baf6e03f35a25204840c1fe5358f2d3e212562 (diff)
downloaddbus-1-tqt-4cdf1eafd1d16a70dfb5199ecab0ac2ce46982c8.tar.gz
dbus-1-tqt-4cdf1eafd1d16a70dfb5199ecab0ac2ce46982c8.zip
Fix memory leak on calling TQT_DBusConnection::sendWithReply
Notably tdepowersave no longer leaks memory after this patch
-rw-r--r--tqdbusconnection.cpp7
1 files changed, 5 insertions, 2 deletions
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);