summaryrefslogtreecommitdiff
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorIan Fan <[email protected]>2018-12-08 23:55:14 +0000
committerIan Fan <[email protected]>2018-12-09 01:15:38 +0000
commitc8776fac4232f9faab0a78ef3e18dc4366496421 (patch)
tree028fbc584d233a7a934feb0b6807c9a988c8e7f1 /sway/ipc-server.c
parent19e831ed3da2aba75d56e46c57967bcc60442d57 (diff)
Cleanup list code
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index b3954259..2c642a37 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -73,14 +73,11 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
unlink(ipc_sockaddr->sun_path);
while (ipc_client_list->length) {
- struct ipc_client *client = ipc_client_list->items[0];
- ipc_client_disconnect(client);
+ ipc_client_disconnect(ipc_client_list->items[ipc_client_list->length-1]);
}
list_free(ipc_client_list);
- if (ipc_sockaddr) {
- free(ipc_sockaddr);
- }
+ free(ipc_sockaddr);
wl_list_remove(&ipc_display_destroy.link);
}