mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Avoid crash when event_pending() called with no event_base set on event
Instead, give a warning and return 0. Reported by Antony Dovgal on github as https://github.com/libevent/libevent/issues/19
This commit is contained in:
parent
ac356502d3
commit
e3cccf380c
5
event.c
5
event.c
@ -1850,6 +1850,11 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if (EVUTIL_FAILURE_CHECK(ev->ev_base == NULL)) {
|
||||
event_warnx("%s: event has no event_base set.", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
|
||||
_event_debug_assert_is_setup(ev);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user