This is a Swiss army knife API with a “realloc” that can do alloc (if old size is 0), free (if new size is 0) or realloc (general case), and which his also parametrized by user data, such that it is a proper closure.
A full-blown allocator interface is something like what SQLite does, with a vtable of multiple methods and a context pointer.
But unless you have very sophisticated allocation needs (e.g. your library is a database ), replicating std.mem.Allocator interface or even just a single realloc function like suggested above should be sufficient to your needs.
FWIW what I’m missing most in my own C library allocator interface is a calloc hook which returns zeroed memory (I just don’t like the calloc function signature at all).
AFAIK on the OS level the zeroing can be done more efficiently than malloc+memset for entire memory pages. Not sure if that’s all that relevant in C libraries where memory allocation frequency is very low and mostly happens at startup anyway though.