mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Improve DBC in isc_mem_free
Unlike standard free(), isc_mem_free() is not a no-op when passed a NULL pointer. For size accounting purposes it calls sallocx(), which crashes when passed a NULL pointer. To get more helpful diagnostics, REQUIRE() that the pointer is not NULL so that when the programmer makes a mistake they get a backtrace that shows what went wrong.
This commit is contained in:
@@ -981,6 +981,7 @@ isc__mem_free(isc_mem_t *ctx, void *ptr FLARG) {
|
||||
size_t size = 0;
|
||||
|
||||
REQUIRE(VALID_CONTEXT(ctx));
|
||||
REQUIRE(ptr != NULL);
|
||||
|
||||
size = sallocx(ptr, 0);
|
||||
|
||||
|
Reference in New Issue
Block a user