summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-18 20:22:57 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2012-09-19 08:25:36 +0200
commitd3b52baff90876a648e321f3658a74bc58a8647c (patch)
tree2e199b9d68a731d1649dfa28a4c63a8766991dcb /src/shared
parent67445f4e22ad924394acdd4fd49e6f238244a5ca (diff)
systemctl: use automatic cleanup
Introduce a helper method to unref dbus messages and use it.
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/dbus-common.c6
-rw-r--r--src/shared/dbus-common.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/shared/dbus-common.c b/src/shared/dbus-common.c
index 0c73d6c6a8..c53bf59eb3 100644
--- a/src/shared/dbus-common.c
+++ b/src/shared/dbus-common.c
@@ -1318,3 +1318,9 @@ finish:
return r;
}
+
+
+void dbus_message_unref_p(DBusMessage **reply) {
+ if (*reply)
+ dbus_message_unref(*reply);
+}
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index e49c3b5258..7294206bc4 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -213,3 +213,6 @@ int bus_method_call_with_reply(DBusConnection *bus,
DBusMessage **return_reply,
DBusError *return_error,
int first_arg_type, ...);
+
+void dbus_message_unref_p(DBusMessage **reply);
+#define _cleanup_dbus_msg_unref_ __attribute__((cleanup(dbus_message_unref_p)))