[hackers] [ii] Fix channel use after freeing in main loop || Vasily Kolobkov

From: <git_AT_suckless.org>
Date: Wed, 24 Feb 2016 23:02:32 +0100 (CET)

commit f79e2f09534d92a6fe4e062b06449a925fef1c41
Author: Vasily Kolobkov <none_AT_none.none>
AuthorDate: Sun Feb 14 13:07:17 2016 +0200
Commit: Nico Golde <nico_AT_ngolde.de>
CommitDate: Wed Feb 24 23:02:19 2016 +0100

    Fix channel use after freeing in main loop
    
    Signed-off-by: Nico Golde <nico_AT_ngolde.de>

diff --git a/ii.c b/ii.c
index 632ee4b..745e29a 100644
--- a/ii.c
+++ b/ii.c
_AT_@ -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;
_AT_@ -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);
+ }
         }
 }
 
Received on Wed Feb 24 2016 - 23:02:32 CET

This archive was generated by hypermail 2.3.0 : Wed Feb 24 2016 - 23:12:14 CET