From 29a285a67d6472cf44204b19bb67e966ddce2971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Fri, 9 Jul 2021 18:19:58 +0200 Subject: [PATCH] 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(). --- lib/isc/netmgr/netmgr.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index b2c59f4800..b495cb615d 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -1259,10 +1259,8 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree FLARG) { isc_astack_destroy(sock->inactivereqs); sock->magic = 0; - isc_mem_put(sock->mgr->mctx, sock->ah_frees, - sock->ah_size * sizeof(sock->ah_frees[0])); - isc_mem_put(sock->mgr->mctx, sock->ah_handles, - sock->ah_size * sizeof(sock->ah_handles[0])); + isc_mem_free(sock->mgr->mctx, sock->ah_frees); + isc_mem_free(sock->mgr->mctx, sock->ah_handles); isc_mutex_destroy(&sock->lock); isc_condition_destroy(&sock->scond); #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); sock->uv_handle.handle.data = sock; - sock->ah_frees = isc_mem_get(mgr->mctx, - sock->ah_size * sizeof(sock->ah_frees[0])); - sock->ah_handles = isc_mem_get( + sock->ah_frees = isc_mem_allocate( + mgr->mctx, sock->ah_size * sizeof(sock->ah_frees[0])); + sock->ah_handles = isc_mem_allocate( mgr->mctx, sock->ah_size * sizeof(sock->ah_handles[0])); ISC_LINK_INIT(&sock->quotacb, link); for (size_t i = 0; i < 32; i++) {