Add missing isc_refcount_destroy and lock the socket ISC_LISTS in destroy()

This commit is contained in:
Ondřej Surý 2019-12-12 12:59:39 +01:00
parent 6f3fdf36b4
commit d35739d516

View file

@ -1832,15 +1832,17 @@ destroy(isc__socket_t **sockp) {
isc__socketmgr_t *manager = sock->manager;
isc__socketthread_t *thread = NULL;
isc_refcount_destroy(&sock->references);
socket_log(sock, NULL, CREATION, "destroying");
LOCK(&sock->lock);
INSIST(ISC_LIST_EMPTY(sock->connect_list));
INSIST(ISC_LIST_EMPTY(sock->accept_list));
INSIST(ISC_LIST_EMPTY(sock->recv_list));
INSIST(ISC_LIST_EMPTY(sock->send_list));
INSIST(sock->fd >= -1 && sock->fd < (int)manager->maxsocks);
LOCK(&sock->lock);
if (sock->fd >= 0) {
fd = sock->fd;
thread = &manager->threads[sock->threadid];