systemctl: use automatic cleanup

Introduce a helper method to unref dbus messages and use it.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2012-09-19 08:25:36 +02:00
parent 67445f4e22
commit d3b52baff9
3 changed files with 17 additions and 14 deletions
+6
View File
@@ -1318,3 +1318,9 @@ finish:
return r;
}
void dbus_message_unref_p(DBusMessage **reply) {
if (*reply)
dbus_message_unref(*reply);
}
+3
View File
@@ -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)))