NULL is OK, both for passing and for returning.
The data is owned by the callee, which is responsible of freeing it.