int r;
uint32_t vtnr = 0;
_cleanup_close_ int fifo_fd = -1;
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
Session *session = NULL;
User *user = NULL;
Seat *seat = NULL;
}
*_reply = reply;
+ reply = NULL;
return 0;
}
}
*_reply = reply;
+ reply = NULL;
return 0;
if (user)
user_add_to_gc_queue(user);
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
InhibitMode mm;
unsigned long ul;
int r, fifo_fd = -1;
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
assert(m);
assert(connection);
close_nointr_nofail(fifo_fd);
*_reply = reply;
+ reply = NULL;
inhibitor_start(i);
if (fifo_fd >= 0)
close_nointr_nofail(fifo_fd);
- if (reply)
- dbus_message_unref(reply);
-
return r;
}
static int attach_device(Manager *m, const char *seat, const char *sysfs) {
struct udev_device *d;
- char *rule = NULL, *file = NULL;
+ char _cleanup_free_ *rule = NULL, *file = NULL;
const char *id_for_seat;
int r;
r = trigger_device(m, d);
finish:
- free(rule);
- free(file);
-
if (d)
udev_device_unref(d);
}
static int flush_devices(Manager *m) {
- DIR *d;
+ DIR _cleanup_closedir_ *d;
assert(m);
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
log_warning("Failed to unlink %s: %m", de->d_name);
}
-
- closedir(d);
}
return trigger_device(m, NULL);
bool multiple_sessions, challenge, blocked, b;
const char *result;
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
unsigned long ul;
reply,
DBUS_TYPE_STRING, &result,
DBUS_TYPE_INVALID);
- if (!b) {
- dbus_message_unref(reply);
+ if (!b)
return -ENOMEM;
- }
*_reply = reply;
+ reply = NULL;
return 0;
}
Manager *m = userdata;
DBusError error;
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
assert(connection);
if (reply) {
if (!bus_maybe_send_reply(connection, message, reply))
goto oom;
-
- dbus_message_unref(reply);
}
return DBUS_HANDLER_RESULT_HANDLED;
oom:
- if (reply)
- dbus_message_unref(reply);
-
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
int manager_send_changed(Manager *manager, const char *properties) {
- DBusMessage *m;
- int r = -ENOMEM;
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL;
assert(manager);
- m = bus_properties_changed_new("/org/freedesktop/login1", "org.freedesktop.login1.Manager", properties);
+ m = bus_properties_changed_new("/org/freedesktop/login1",
+ "org.freedesktop.login1.Manager",
+ properties);
if (!m)
- goto finish;
+ return -ENOMEM;
if (!dbus_connection_send(manager->bus, m, NULL))
- goto finish;
-
- r = 0;
-
-finish:
- if (m)
- dbus_message_unref(m);
+ return -ENOMEM;
- return r;
+ return 0;
}
int manager_dispatch_delayed(Manager *manager) {