diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-14 23:59:51 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-15 00:26:27 +1000 |
commit | 893f61d03a18b8e5dcb3893b2e3d164690a1f433 (patch) | |
tree | 1376349a4bf402dc39c6084cfa5058d3d737f171 | |
parent | 6921fdc6d6134fd7aaf38ffc1686623eca9bbd18 (diff) |
Event loop: Free fds and fix race condition
-rw-r--r-- | common/loop.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/loop.c b/common/loop.c index c358e212..54b034d9 100644 --- a/common/loop.c +++ b/common/loop.c @@ -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); } @@ -66,6 +67,9 @@ void loop_poll(struct loop *loop) { } } } + if (ms < 0) { + ms = 0; + } poll(loop->fds, loop->fd_length, ms); |