Commit Graph
3 Commits
Author SHA1 Message Date
Joachim Wiberg 0b5461d5ff Fix NULL pointer dereference in uev_timer_init()
uev_timer_init() crashes when called without a watcher:

    uev_timer_init(ctx, NULL, cb, NULL, 100, 0);

The cleanup after a failed setup resets the descriptor in the watcher
without checking that there is one.

Check the arguments first, like the other watcher types do.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2026-11-16 15:08:43 +01:00
NefelibateLG 05bc6a0830 Do not leave stdin as descriptor of a failed context
uev_init() leaves the context descriptor at 0 when epoll_create1()
fails.  A following uev_exit() then closes stdin.

Set it to -1 before creating the epoll descriptor.
2026-11-16 14:54:49 +01:00
NefelibateLG 4792b988a1 Fix eventfd leak in uev_event_init()
uev_event_init() leaks its eventfd, and leaves it in the watcher, when
the watcher cannot be added to the event loop.

Close it and reset the descriptor in the watcher.
2026-11-16 14:54:49 +01:00