8000 BUG: PyErr_NoMemory when PyArray_Zeros fails to initialize · numpy/numpy@c3888e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3888e7

Browse files
grahamcjuliantaylor
authored andcommitted
BUG: PyErr_NoMemory when PyArray_Zeros fails to initialize
1 parent b82230f commit c3888e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

numpy/fft/fftpack_litemodule.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args)
151151
PyObject *op1, *op2;
152152
PyArrayObject *data, *ret;
153153
PyArray_Descr *descr;
154-
double *wsave, *dptr, *rptr;
154+
double *wsave = NULL, *dptr, *rptr;
155155
npy_intp nsave;
156156
int npts, nrepeats, i, rstep;
157157

@@ -168,6 +168,9 @@ fftpack_rfftf(PyObject *NPY_UNUSED(self), PyObject *args)
168168
PyArray_DIMS(data)[PyArray_NDIM(data) - 1] = npts/2 + 1;
169169
ret = (PyArrayObject *)PyArray_Zeros(PyArray_NDIM(data),
170170
PyArray_DIMS(data), PyArray_DescrFromType(NPY_CDOUBLE), 0);
171+
if (ret == NULL) {
172+
goto fail;
173+
}
171174
PyArray_DIMS(data)[PyArray_NDIM(data) - 1] = npts;
172175
rstep = PyArray_DIM(ret, PyArray_NDIM(ret) - 1)*2;
173176

0 commit comments

Comments
 (0)
0