]> git.ipfire.org Git - thirdparty/bind9.git/commit
Remove nonnull attribute from isc_mem_{get,allocate,reallocate}
authorOndřej Surý <ondrej@sury.org>
Mon, 12 Jul 2021 07:18:12 +0000 (09:18 +0200)
committerOndřej Surý <ondrej@sury.org>
Mon, 12 Jul 2021 08:02:18 +0000 (10:02 +0200)
commitce03015d48ee01dff0cf009be04acce9814ac079
tree8a1e3b2d301f70fba63d9c9773b8f53094e6d044
parentb9722ce98f9ea223909a4041b7c2094104a524d6
Remove nonnull attribute from isc_mem_{get,allocate,reallocate}

The isc_mem_get(), isc_mem_allocate() and isc_mem_reallocate() can
return NULL ptr in case where the allocation size is NULL.  Remove the
nonnull attribute from the functions' declarations.

This stems from the following definition in the C11 standard:

> If the size of the space requested is zero, the behavior is
> implementation-defined: either a null pointer is returned, or the
> behavior is as if the size were some nonzero value, except that the
> returned pointer shall not be used to access an object.

In this case, we return NULL as it's easier to detect errors when
accessing pointer from zero-sized allocation which should obviously
never happen.
lib/isc/include/isc/mem.h