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