pjmlp a day ago

Section 7.24.3.7 The realloc function

https://open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf

> If ptr is a null pointer, the realloc function behaves like the malloc function for the specified size. Otherwise, if ptr does not match a pointer earlier returned by a memory management function, or if the space has been deallocated by a call to the free or realloc function, or if the size is zero, the behavior is undefined. If memory for the new object is not allocated, the old object is not deallocated and its value is unchanged.