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:
@@ -2869,7 +2869,7 @@ dns_adb_shutdown(dns_adb_t *adb) {
|
||||
|
||||
if (!adb->shutting_down) {
|
||||
adb->shutting_down = true;
|
||||
isc_mem_setwater(adb->mctx, water, adb, 0, 0);
|
||||
isc_mem_setwater(adb->mctx, NULL, NULL, 0, 0);
|
||||
/*
|
||||
* Isolate shutdown_names and shutdown_entries calls.
|
||||
*/
|
||||
@@ -4699,7 +4699,7 @@ dns_adb_setadbsize(dns_adb_t *adb, size_t size) {
|
||||
lowater = size - (size >> 2); /* Approximately 3/4ths. */
|
||||
|
||||
if (size == 0U || hiwater == 0U || lowater == 0U) {
|
||||
isc_mem_setwater(adb->mctx, water, adb, 0, 0);
|
||||
isc_mem_setwater(adb->mctx, NULL, NULL, 0, 0);
|
||||
} else {
|
||||
isc_mem_setwater(adb->mctx, water, adb, hiwater, lowater);
|
||||
}
|
||||
|
Reference in New Issue
Block a user