aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2018-07-04 18:48:57 +0900
committerDominique Martinet <asmadeus@codewreck.org>2018-07-05 08:13:10 +0900
commitffe9de6e24b451ba7885bc52c78fd676598bf7cd (patch)
tree54ec5b981d58703f7944bdacd488cf3ccf2f1d70
parent9f5d5396579e0029c8841992ca39e850281a2df6 (diff)
downloadsway-ffe9de6e24b451ba7885bc52c78fd676598bf7cd.tar.xz
ipc-server: free clients at destroy
-rw-r--r--sway/ipc-server.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index abc2d7cb..01b80b05 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -64,6 +64,10 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
close(ipc_socket);
unlink(ipc_sockaddr->sun_path);
+ while (ipc_client_list->length) {
+ struct ipc_client *client = ipc_client_list->items[0];
+ ipc_client_disconnect(client);
+ }
list_free(ipc_client_list);
if (ipc_sockaddr) {
@@ -480,6 +484,7 @@ void ipc_client_handle_command(struct ipc_client *client) {
const char *json = cmd_results_to_json(results);
char reply[256];
int length = snprintf(reply, sizeof(reply), "%s", json);
+ free(json);
client_valid = ipc_send_reply(client, reply, (uint32_t)length);
free_cmd_results(results);
goto exit_cleanup;