BUG: ufunc: Fix potential memory leak. (#19925)
BUG: ufunc: Fix potential memory leak. (#19925)

* BUG: ufunc: Fix potential memory leak.

Change a return statement to 'goto fail;' to ensure that memory
previously allocated with PyArray_malloc() is freed.  (The memory
pointers are 'funcdata' and 'newtypes'.)

The return *value* in this case is also changed, from 0 to -1, to indicate
that an error occurred.  The exceptional return occurs because an unexpected
error occurred in the call to PyDict_GetItemWithError.

Closes gh-19548.
rgommers/numpy,rgommers/numpy,pdebuyl/numpy,jakirkham/numpy,mattip/numpy,endolith/numpy,seberg/numpy,anntzer/numpy,mhvk/numpy,endolith/numpy,seberg/numpy,mattip/numpy,mattip/numpy,pdebuyl/numpy,numpy/numpy,rgommers/numpy,mattip/numpy,anntzer/numpy,simongibbons/numpy,pdebuyl/numpy,charris/numpy,charris/numpy,anntzer/numpy,endolith/numpy,anntzer/numpy,mhvk/numpy,simongibbons/numpy,jakirkham/numpy,simongibbons/numpy,rgommers/numpy,simongibbons/numpy,endolith/numpy,mhvk/numpy,mhvk/numpy,simongibbons/numpy,seberg/numpy,mhvk/numpy,jakirkham/numpy,jakirkham/numpy,charris/numpy,numpy/numpy,jakirkham/numpy,numpy/numpy,pdebuyl/numpy,charris/numpy,numpy/numpy,seberg/numpy