summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVasily Kolobkov <none@none.none>2016-02-14 13:07:17 +0200
committerNico Golde <nico@ngolde.de>2016-02-24 23:02:19 +0100
commitf79e2f09534d92a6fe4e062b06449a925fef1c41 (patch)
tree18d06821ac4f94d32833ff806bbcff7c629ab85c
parent165638e3c81213956a6b41d5889ba05186f4f771 (diff)
downloadii-f79e2f09534d92a6fe4e062b06449a925fef1c41.zip
ii-f79e2f09534d92a6fe4e062b06449a925fef1c41.tar.gz
ii-f79e2f09534d92a6fe4e062b06449a925fef1c41.tar.bz2
Fix channel use after freeing in main loop
Signed-off-by: Nico Golde <nico@ngolde.de>
-rw-r--r--ii.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ii.c b/ii.c
index 632ee4b..745e29a 100644
--- a/ii.c
+++ b/ii.c
@@ -418,7 +418,7 @@ static void handle_server_output() {
}
static void run() {
- Channel *c;
+ Channel *c, *n;
int r, maxfd;
fd_set rd;
struct timeval tv;
@@ -455,9 +455,11 @@ static void run() {
handle_server_output();
last_response = time(NULL);
}
- for(c = channels; c; c = c->next)
+ for(c = channels; c; c = n) {
+ n = c->next;
if(FD_ISSET(c->fd, &rd))
handle_channels_input(c);
+ }
}
}