]> git.ipfire.org Git - thirdparty/bind9.git/commit
Allow size == 0 in isc_mem_{get,allocate,reallocate}
authorOndřej Surý <ondrej@sury.org>
Thu, 10 Jun 2021 08:18:24 +0000 (10:18 +0200)
committerOndřej Surý <ondrej@sury.org>
Fri, 9 Jul 2021 13:58:02 +0000 (15:58 +0200)
commit798333d456eb79011907ef19e08fc2ebe4bbd67e
treef561119bcbb333a39f0b2de7e9b9ed0c88d9aa30
parente20cc41e56905fbd32c7824f7cf8bdf6a5db6d1c
Allow size == 0 in isc_mem_{get,allocate,reallocate}

Calls to jemalloc extended API with size == 0 ends up in undefined
behaviour.  This commit makes the isc_mem_get() and friends calls
more POSIX aligned:

  If size is 0, either a null pointer or a unique pointer that can be
  successfully passed to free() shall be returned.

We picked the easier route (which have been already supported in the old
code) and return NULL on calls to the API where size == 0.
lib/isc/mem.c