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

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,11 +455,13 @@ 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);
}
}
}
int main(int argc, char *argv[]) {
int i;