diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2015-01-25 16:58:23 +0100 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2015-01-25 16:58:23 +0100 |
commit | 937d1f25e5fee1543a55ef5e6bcf27e5a7ec3bf9 (patch) | |
tree | 3454b0a8737274f3aac369d0604976e633bf8608 /numpy/fft | |
parent | 2344c268a429b974d996368e0172c65efe970f61 (diff) | |
parent | c3888e73fff4731018e3733a9d1d66441b2a8146 (diff) | |
download | numpy-937d1f25e5fee1543a55ef5e6bcf27e5a7ec3bf9.tar.gz |
Merge pull request #5492 from grahamc/gotofail-malloc-ret-null-fft
PyErr_NoMemory when PyArray_Zeros fails to initialize
Diffstat (limited to 'numpy/fft')
-rw-r--r-- | numpy/fft/fftpack_litemodule.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/fft/fftpack_litemodule.c b/numpy/fft/fftpack_litemodule.c index 7b37ce9b7..e895d0efe 100644 --- a/numpy/fft/fftpack_litemodule.c +++ b/numpy/fft/fftpack_litemodule.c @@ -149,7 +149,7 @@ fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args) PyObject *op1, *op2; PyArrayObject *data, *ret; PyArray_Descr *descr; - double *wsave, *dptr, *rptr; + double *wsave = NULL, *dptr, *rptr; npy_intp nsave; int npts, nrepeats, i, rstep; @@ -166,6 +166,9 @@ fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args) PyArray_DIMS(data)[PyArray_NDIM(data) - 1] = npts/2 + 1; ret = (PyArrayObject *)PyArray_Zeros(PyArray_NDIM(data), PyArray_DIMS(data), PyArray_DescrFromType(NPY_CDOUBLE), 0); + if (ret == NULL) { + goto fail; + } PyArray_DIMS(data)[PyArray_NDIM(data) - 1] = npts; rstep = PyArray_DIM(ret, PyArray_NDIM(ret) - 1)*2; |