Skip to content

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.

Closes #2816 (closed)

Merge request reports