]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix the sizeof() for array holding the pointers to clientmgr
authorOndřej Surý <ondrej@sury.org>
Wed, 26 May 2021 08:01:30 +0000 (10:01 +0200)
committerOndřej Surý <ondrej@sury.org>
Wed, 26 May 2021 08:03:52 +0000 (10:03 +0200)
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).

lib/ns/interfacemgr.c

index 1ff6bcb859dab0dce154ae9fe5dd7ab574ad1d94..54e2ed7a69735bf59ee8a280bd08c195c270c39d 100644 (file)
@@ -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);