This allows the caller to return directly on such an error, with an appropriate errno value.
This is intended as a type-safe alternative to obstacks and hand-written realloc constructs. The implementation avoids writing function pointers to the heap.