2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Properly disable the "water" in isc_mem

The proper way how to disable the water limit in the isc_mem context is
to call:

    isc_mem_setwater(ctx, NULL, NULL, 0, 0);

this ensures that the old water callback is called with ISC_MEM_LOWATER
if the callback was called with ISC_MEM_HIWATER before.

Historically, there were some places where the limits were disabled by
calling:

    isc_mem_setwater(ctx, water, water_arg, 0, 0);

which would also call the old callback, but it also causes the water_t
to be allocated and extra check to be executed because water callback is
not NULL.

This commits unifies the calls to disable water to the preferred form.
This commit is contained in:
Ondřej Surý
2021-07-09 14:35:00 +02:00
parent ca228ec3e5
commit 9c3bebc26f
2 changed files with 3 additions and 3 deletions

View File

@@ -950,7 +950,7 @@ dns_cache_setcachesize(dns_cache_t *cache, size_t size) {
/*
* Disable cache memory limiting.
*/
isc_mem_setwater(cache->mctx, water, cache, 0, 0);
isc_mem_setwater(cache->mctx, NULL, NULL, 0, 0);
} else {
/*
* Establish new cache memory limits (either for the first