summaryrefslogtreecommitdiff
path: root/src/login/loginctl.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2013-03-18 14:38:48 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-18 19:59:33 -0400
commitce0fc5f5f6debc6e37ac3ab0a3ea1c9c35b3ed99 (patch)
treeb94ff8a4451a0484ac307ba9f7894f624c21f722 /src/login/loginctl.c
parentc6a818c82035da91e7987920510f0dda61d8781a (diff)
logind: Make more use of cleanup macros
Diffstat (limited to 'src/login/loginctl.c')
-rw-r--r--src/login/loginctl.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/src/login/loginctl.c b/src/login/loginctl.c
index fe27003a92..387095361d 100644
--- a/src/login/loginctl.c
+++ b/src/login/loginctl.c
@@ -72,7 +72,7 @@ static void polkit_agent_open_if_enabled(void) {
}
static int list_sessions(DBusConnection *bus, char **args, unsigned n) {
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
DBusMessageIter iter, sub, sub2;
unsigned k = 0;
@@ -139,14 +139,11 @@ static int list_sessions(DBusConnection *bus, char **args, unsigned n) {
r = 0;
finish:
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
static int list_users(DBusConnection *bus, char **args, unsigned n) {
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
DBusMessageIter iter, sub, sub2;
unsigned k = 0;
@@ -211,14 +208,11 @@ static int list_users(DBusConnection *bus, char **args, unsigned n) {
r = 0;
finish:
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
static int list_seats(DBusConnection *bus, char **args, unsigned n) {
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
DBusMessageIter iter, sub, sub2;
unsigned k = 0;
@@ -281,9 +275,6 @@ static int list_seats(DBusConnection *bus, char **args, unsigned n) {
r = 0;
finish:
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
@@ -961,7 +952,7 @@ finish:
}
static int show(DBusConnection *bus, char **args, unsigned n) {
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r, ret = 0;
DBusError error;
unsigned i;
@@ -1048,15 +1039,9 @@ static int show(DBusConnection *bus, char **args, unsigned n) {
r = show_one(args[0], bus, path, show_properties, &new_line);
if (r != 0)
ret = r;
-
- dbus_message_unref(reply);
- reply = NULL;
}
finish:
- if (reply)
- dbus_message_unref(reply);
-
dbus_error_free(&error);
return ret;