Skip to content

Commit

Permalink
Event loop: Free fds and fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanDwyer committed Oct 14, 2018
1 parent 6921fdc commit 893f61d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions common/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ void loop_destroy(struct loop *loop) {
list_foreach(loop->timers, free);
list_free(loop->fd_events);
list_free(loop->timers);
free(loop->fds);
free(loop);
}

Expand All @@ -66,6 +67,9 @@ void loop_poll(struct loop *loop) {
}
}
}
if (ms < 0) {
ms = 0;
}

poll(loop->fds, loop->fd_length, ms);

Expand Down

0 comments on commit 893f61d

Please sign in to comment.