diff options
author | Niels Provos <provos@gmail.com> | 2004-12-14 03:36:12 +0000 |
---|---|---|
committer | Niels Provos <provos@gmail.com> | 2004-12-14 03:36:12 +0000 |
commit | bd6999b4a2b60fdd4e2e317ca84d382f2b9b0ace (patch) | |
tree | 2e7891f697d97f846c6b7c798c452b71fb5359c5 | |
parent | d9cf6fe2f16eae6d97251b905473aea4e57ed0c6 (diff) | |
download | libevent-bd6999b4a2b60fdd4e2e317ca84d382f2b9b0ace.tar.gz |
fix issue where event_del is called before event_set. bad bad thing to do.
pointed out by Mark Kidwell <MKidwell@looksmart.net>
svn:r128
-rw-r--r-- | event.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -591,13 +591,21 @@ event_add(struct event *ev, struct timeval *tv) int event_del(struct event *ev) { - struct event_base *base = ev->ev_base; - const struct eventop *evsel = base->evsel; - void *evbase = base->evbase; + struct event_base *base; + const struct eventop *evsel; + void *evbase; LOG_DBG((LOG_MISC, 80, "event_del: %p, callback %p", ev, ev->ev_callback)); + /* An event without a base has not been added */ + if (ev->ev_base == NULL) + return; + + base = ev->ev_base; + evsel = base->evsel; + evbase = base->evbase; + assert(!(ev->ev_flags & ~EVLIST_ALL)); /* See if we are just active executing this event in a loop */ |