bufferevent_remove_from_rate_limit_group(bufev);
if (event_initialized(&bufev_private->rate_limiting->refill_bucket_event))
event_del(&bufev_private->rate_limiting->refill_bucket_event);
+ event_debug_unassign(&bufev_private->rate_limiting->refill_bucket_event);
mm_free(bufev_private->rate_limiting);
bufev_private->rate_limiting = NULL;
}
+ event_debug_unassign(&bufev->ev_read);
+ event_debug_unassign(&bufev->ev_write);
+
BEV_UNLOCK(bufev);
if (bufev_private->own_lock)
EVTHREAD_FREE_LOCK(bufev_private->lock,
port->socket = -1;
}
(void) event_del(&port->event);
+ event_debug_unassign(&port->event);
EVTHREAD_FREE_LOCK(port->lock, EVTHREAD_LOCKTYPE_RECURSIVE);
mm_free(port);
}
out2:
CLOSE_SOCKET(ns->socket);
out1:
+ event_debug_unassign(&ns->event);
mm_free(ns);
log(EVDNS_LOG_WARN, "Unable to add nameserver %s: error %d", debug_ntop(address), err);
return err;
}
}
+static void
+evdns_nameserver_free(struct nameserver *server)
+{
+ if (server->socket >= 0)
+ CLOSE_SOCKET(server->socket);
+ (void) event_del(&server->event);
+ event_debug_unassign(&server->event);
+ if (server->state == 0)
+ (void) event_del(&server->timeout_event);
+ event_debug_unassign(&server->timeout_event);
+ mm_free(server);
+}
+
static void
evdns_base_free_and_unlock(struct evdns_base *base, int fail_requests)
{
for (server = base->server_head; server; server = server_next) {
server_next = server->next;
- if (server->socket >= 0)
- CLOSE_SOCKET(server->socket);
- (void) event_del(&server->event);
- if (server->state == 0)
- (void) event_del(&server->timeout_event);
- mm_free(server);
+ evdns_nameserver_free(server);
if (server_next == base->server_head)
break;
}
EVUTIL_CLOSESOCKET(base->th_notify_fd[1]);
base->th_notify_fd[0] = -1;
base->th_notify_fd[1] = -1;
+ event_debug_unassign(&base->th_notify);
}
/* Delete all non-internal events. */
struct common_timeout_list *ctl =
base->common_timeout_queues[i];
event_del(&ctl->timeout_event); /* Internal; doesn't count */
+ event_debug_unassign(&ctl->timeout_event);
for (ev = TAILQ_FIRST(&ctl->events); ev; ) {
struct event *next = TAILQ_NEXT(ev,
ev_timeout_pos.ev_next_with_common_timeout);
struct event_once *eonce = arg;
(*eonce->cb)(fd, events, eonce->arg);
+ event_debug_unassign(&eonce->ev);
mm_free(eonce);
}
TAILQ_REMOVE(&http->connections, evcon, next);
}
- if (event_initialized(&evcon->retry_ev))
+ if (event_initialized(&evcon->retry_ev)) {
event_del(&evcon->retry_ev);
+ event_debug_unassign(&evcon->retry_ev);
+ }
if (evcon->bufev != NULL)
bufferevent_free(evcon->bufev);
{
TAILQ_REMOVE(&http->sockets, bound, next);
event_del(&bound->bind_ev);
+ event_debug_unassign(&bound->bind_ev);
mm_free(bound);
}
lev = mm_calloc(1, sizeof(struct evconnlistener_event));
if (!lev)
return NULL;
-
+
lev->base.ops = &evconnlistener_event_ops;
lev->base.cb = cb;
lev->base.user_data = ptr;
event_assign(&lev->listener, base, fd, EV_READ|EV_PERSIST,
listener_read_cb, lev);
evconnlistener_enable(&lev->base);
-
+
return &lev->base;
}
{
struct evconnlistener_event *lev_e =
EVUTIL_UPCAST(lev, struct evconnlistener_event, base);
-
+
event_del(&lev_e->listener);
if (lev->flags & LEV_OPT_CLOSE_ON_FREE)
EVUTIL_CLOSESOCKET(event_get_fd(&lev_e->listener));
+ event_debug_unassign(&lev_e->listener);
}
int
int i = 0;
if (base->sig.ev_signal_added) {
event_del(&base->sig.ev_signal);
+ event_debug_unassign(&base->sig.ev_signal);
base->sig.ev_signal_added = 0;
}
for (i = 0; i < NSIG; ++i) {