Fix channel use after freeing in main loop

Signed-off-by: Nico Golde <nico@ngolde.de>
This commit is contained in:
Vasily Kolobkov 2016-02-14 13:07:17 +02:00 committed by Nico Golde
parent 165638e3c8
commit f79e2f0953
1 changed files with 4 additions and 2 deletions

6
ii.c
View File

@ -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);
}
}
}