summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2015-01-23 13:09:23 -0600
committerJulian Taylor <jtaylor.debian@googlemail.com>2015-01-25 16:57:39 +0100
commitc3888e73fff4731018e3733a9d1d66441b2a8146 (patch)
tree93e623d99d0d8bdd2bc679d717eff92ca25b3ec0 /numpy
parentb82230fdb438ba368e18ad8d3c55cb4779ab2acf (diff)
downloadnumpy-c3888e73fff4731018e3733a9d1d66441b2a8146.tar.gz
BUG: PyErr_NoMemory when PyArray_Zeros fails to initialize
Diffstat (limited to 'numpy')
-rw-r--r--numpy/fft/fftpack_litemodule.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/fft/fftpack_litemodule.c b/numpy/fft/fftpack_litemodule.c
index 95da3194f..4a011a00a 100644
--- a/numpy/fft/fftpack_litemodule.c
+++ b/numpy/fft/fftpack_litemodule.c
@@ -151,7 +151,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;
@@ -168,6 +168,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;