2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

Revert the allocate/free -> get/put change from jemalloc change

In the jemalloc merge request, we missed the fact that ah_frees and ah_handles
are reallocated which is not compatible with using isc_mem_get() for allocation
and isc_mem_put() for deallocation.  This commit reverts that part and restores
use of isc_mem_allocate() and isc_mem_free().
This commit is contained in:
Ondřej Surý
2021-07-09 18:19:58 +02:00
parent 2ceca6f24d
commit 29a285a67d

View File

@@ -1259,10 +1259,8 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree FLARG) {
isc_astack_destroy(sock->inactivereqs); isc_astack_destroy(sock->inactivereqs);
sock->magic = 0; sock->magic = 0;
isc_mem_put(sock->mgr->mctx, sock->ah_frees, isc_mem_free(sock->mgr->mctx, sock->ah_frees);
sock->ah_size * sizeof(sock->ah_frees[0])); isc_mem_free(sock->mgr->mctx, sock->ah_handles);
isc_mem_put(sock->mgr->mctx, sock->ah_handles,
sock->ah_size * sizeof(sock->ah_handles[0]));
isc_mutex_destroy(&sock->lock); isc_mutex_destroy(&sock->lock);
isc_condition_destroy(&sock->scond); isc_condition_destroy(&sock->scond);
#if HAVE_LIBNGHTTP2 #if HAVE_LIBNGHTTP2
@@ -1474,9 +1472,9 @@ isc___nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr, isc_nmsocket_type type,
isc_nm_attach(mgr, &sock->mgr); isc_nm_attach(mgr, &sock->mgr);
sock->uv_handle.handle.data = sock; sock->uv_handle.handle.data = sock;
sock->ah_frees = isc_mem_get(mgr->mctx, sock->ah_frees = isc_mem_allocate(
sock->ah_size * sizeof(sock->ah_frees[0])); mgr->mctx, sock->ah_size * sizeof(sock->ah_frees[0]));
sock->ah_handles = isc_mem_get( sock->ah_handles = isc_mem_allocate(
mgr->mctx, sock->ah_size * sizeof(sock->ah_handles[0])); mgr->mctx, sock->ah_size * sizeof(sock->ah_handles[0]));
ISC_LINK_INIT(&sock->quotacb, link); ISC_LINK_INIT(&sock->quotacb, link);
for (size_t i = 0; i < 32; i++) { for (size_t i = 0; i < 32; i++) {