Fix memory leak in tostring_rgba_minimize(). (#3197)

The APIs being used in PyCXX (and Python C-API) were not actually taking
ownership. Instead, make Python allocate memory.