]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Revert the allocate/free -> get/put change from jemalloc change
authorOndřej Surý <ondrej@sury.org>
Fri, 9 Jul 2021 16:19:58 +0000 (18:19 +0200)
committerOndřej Surý <ondrej@sury.org>
Fri, 9 Jul 2021 16:19:57 +0000 (18:19 +0200)
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

index b2c59f48004039f57c2baf521afbe19083f557bc..b495cb615d2e000302d1731072817b9c5695f42d 100644 (file)
@@ -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++) {