*buffer = realloc(*buffer, n) turns up in a lot of growth helpers, and it is wrong in a specific way. If the allocation fails, the only owned pointer is overwritten with null. The C11 draft says the old object stays allocated and unchanged in that case. The helper has just lost the one route to storage it still has to release.
The helper I have in mind takes char **buffer and size_t *capacity from the caller. *buffer owns a valid allocation, and the requested size is strictly positive and larger than the current capacity.
Put the result in a temporary pointer first. On failure, return an allocation error and leave both output slots as they were. On success, write the returned pointer and the new capacity.
One more rule belongs in the documentation. A successful realloc ends the old object's lifetime, so any alias a caller saved is dead even when the returned address happens to be the same. My draft returns plain success or failure and tells callers to rebuild their aliases after success. I think that covers it, but I am not fully sure the alias rule is clear enough as written.

