From 09a2246b00fdb5b18db13b65d6496511dabba238 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 13 May 2020 21:11:46 +0100 Subject: [PATCH] Use safe loop for freeing client files. --- server-client.c | 7 +++---- tmux.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server-client.c b/server-client.c index 6e24fdf3..2e9f15a6 100644 --- a/server-client.c +++ b/server-client.c @@ -211,7 +211,6 @@ server_client_create(int fd) c->queue = cmdq_new(); c->tty.fd = -1; - c->tty.sx = 80; c->tty.sy = 24; @@ -270,7 +269,7 @@ server_client_open(struct client *c, char **cause) void server_client_lost(struct client *c) { - struct client_file *cf; + struct client_file *cf, *cf1; c->flags |= CLIENT_DEAD; @@ -278,7 +277,7 @@ server_client_lost(struct client *c) status_prompt_clear(c); status_message_clear(c); - RB_FOREACH(cf, client_files, &c->files) { + RB_FOREACH_SAFE(cf, client_files, &c->files, cf1) { cf->error = EINTR; file_fire_done(cf); } @@ -2252,7 +2251,7 @@ server_client_set_flags(struct client *c, const char *flags) } -/*Get client flags. This is only flags useful to show to users. */ +/* Get client flags. This is only flags useful to show to users. */ const char * server_client_get_flags(struct client *c) { diff --git a/tmux.h b/tmux.h index 932d85ec..4c9d229f 100644 --- a/tmux.h +++ b/tmux.h @@ -1506,7 +1506,7 @@ struct client_file { client_file_cb cb; void *data; - RB_ENTRY (client_file) entry; + RB_ENTRY(client_file) entry; }; RB_HEAD(client_files, client_file);