aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/input-manager.c9
-rw-r--r--sway/input/seat.c1
2 files changed, 6 insertions, 4 deletions
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c
index b20b7b7e..4459c43b 100644
--- a/sway/input/input-manager.c
+++ b/sway/input/input-manager.c
@@ -119,10 +119,11 @@ static void input_add_notify(struct wl_listener *listener, void *data) {
bool added = false;
wl_list_for_each(seat, &input->seats, link) {
- if (seat->config &&
- (seat_config_get_attachment(seat->config,
- input_device->identifier) ||
- seat_config_get_attachment(seat->config, "*"))) {
+ bool has_attachment = seat->config &&
+ (seat_config_get_attachment(seat->config, input_device->identifier) ||
+ seat_config_get_attachment(seat->config, "*"));
+
+ if (has_attachment) {
sway_seat_add_device(seat, input_device);
added = true;
}
diff --git a/sway/input/seat.c b/sway/input/seat.c
index df1427fa..fe90565a 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -30,6 +30,7 @@ struct sway_seat *sway_seat_create(struct sway_input_manager *input,
seat->wlr_seat = wlr_seat_create(input->server->wl_display, seat_name);
if (!sway_assert(seat->wlr_seat, "could not allocate seat")) {
+ free(seat);
return NULL;
}