diff options
author | Tony Crisci <tony@dubstepdish.com> | 2017-12-20 06:12:08 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2017-12-20 06:12:08 -0500 |
commit | 63f7fb95172a72436698a1562b4f7ea1e9100a7e (patch) | |
tree | 7b1191368f446c7ee24ce41eb36d0cd3a86a6c35 /sway | |
parent | a4c1270ef0a3c5bd610b13867be7616a55e59dc5 (diff) |
cleanup
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config/seat.c | 3 | ||||
-rw-r--r-- | sway/input/input-manager.c | 9 | ||||
-rw-r--r-- | sway/input/seat.c | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/sway/config/seat.c b/sway/config/seat.c index 4c9e8d0d..113139e8 100644 --- a/sway/config/seat.c +++ b/sway/config/seat.c @@ -14,6 +14,7 @@ struct seat_config *new_seat_config(const char* name) { sway_log(L_DEBUG, "new_seat_config(%s)", name); seat->name = strdup(name); if (!sway_assert(seat->name, "could not allocate name for seat")) { + free(seat); return NULL; } @@ -21,6 +22,8 @@ struct seat_config *new_seat_config(const char* name) { seat->attachments = create_list(); if (!sway_assert(seat->attachments, "could not allocate seat attachments list")) { + free(seat->name); + free(seat); return NULL; } 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; } |