From: Ondřej Surý Date: Wed, 26 May 2021 08:01:30 +0000 (+0200) Subject: Fix the sizeof() for array holding the pointers to clientmgr X-Git-Tag: v9.17.14~23^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2db529057980d2fd879b2d8a5d94487042db215a;p=thirdparty%2Fbind9.git Fix the sizeof() for array holding the pointers to clientmgr The size of the array holding the pointers to clientmgr was created so big it could hold the actual clientmgr objects, not just the pointer. This commit fixes the size to be just the ncpus * sizeof(pointer). --- diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index 1ff6bcb859d..54e2ed7a697 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -272,7 +272,7 @@ ns_interfacemgr_create(isc_mem_t *mctx, ns_server_t *sctx, *mgrp = mgr; mgr->clientmgrs = isc_mem_get(mgr->mctx, - mgr->ncpus * sizeof(*mgr->clientmgrs[0])); + mgr->ncpus * sizeof(mgr->clientmgrs[0])); for (size_t i = 0; i < (size_t)mgr->ncpus; i++) { result = ns_clientmgr_create(mgr->sctx, mgr->taskmgr, mgr->timermgr, mgr->aclenv, (int)i, @@ -333,7 +333,7 @@ ns_interfacemgr_destroy(ns_interfacemgr_t *mgr) { ns_clientmgr_destroy(&mgr->clientmgrs[i]); } isc_mem_put(mgr->mctx, mgr->clientmgrs, - mgr->ncpus * sizeof(*mgr->clientmgrs[0])); + mgr->ncpus * sizeof(mgr->clientmgrs[0])); if (mgr->sctx != NULL) { ns_server_detach(&mgr->sctx);