systemctl: use automatic cleanup
Introduce a helper method to unref dbus messages and use it.
This commit is contained in:
@@ -1318,3 +1318,9 @@ finish:
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
void dbus_message_unref_p(DBusMessage **reply) {
|
||||
if (*reply)
|
||||
dbus_message_unref(*reply);
|
||||
}
|
||||
|
||||
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user