With the approach of having the caller allocate you have carefully design the API to make it possible.