aboutsummaryrefslogtreecommitdiffstats
path: root/common/loop.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-14 23:59:51 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-15 00:26:27 +1000
commit893f61d03a18b8e5dcb3893b2e3d164690a1f433 (patch)
tree1376349a4bf402dc39c6084cfa5058d3d737f171 /common/loop.c
parentRemove timerfd from loop implementation (diff)
downloadsway-893f61d03a18b8e5dcb3893b2e3d164690a1f433.tar.gz
sway-893f61d03a18b8e5dcb3893b2e3d164690a1f433.tar.zst
sway-893f61d03a18b8e5dcb3893b2e3d164690a1f433.zip
Event loop: Free fds and fix race condition
Diffstat (limited to 'common/loop.c')
-rw-r--r--common/loop.c4
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) {
48 list_foreach(loop->timers, free); 48 list_foreach(loop->timers, free);
49 list_free(loop->fd_events); 49 list_free(loop->fd_events);
50 list_free(loop->timers); 50 list_free(loop->timers);
51 free(loop->fds);
51 free(loop); 52 free(loop);
52} 53}
53 54
@@ -66,6 +67,9 @@ void loop_poll(struct loop *loop) {
66 } 67 }
67 } 68 }
68 } 69 }
70 if (ms < 0) {
71 ms = 0;
72 }
69 73
70 poll(loop->fds, loop->fd_length, ms); 74 poll(loop->fds, loop->fd_length, ms);
71 75