diff options
-rw-r--r-- | numpy/core/src/multiarraymodule.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/numpy/core/src/multiarraymodule.c b/numpy/core/src/multiarraymodule.c index 9bdaba821..17f3bcff9 100644 --- a/numpy/core/src/multiarraymodule.c +++ b/numpy/core/src/multiarraymodule.c @@ -5814,6 +5814,7 @@ static PyObject * array__reconstruct(PyObject *dummy, PyObject *args) { + PyObject *ret; PyTypeObject *subtype; PyArray_Dims shape = {NULL, 0}; PyArray_Descr *dtype=NULL; @@ -5829,9 +5830,12 @@ array__reconstruct(PyObject *dummy, PyObject *args) goto fail; } - return PyArray_NewFromDescr(subtype, dtype, - (int)shape.len, shape.ptr, - NULL, NULL, 0, NULL); + ret = PyArray_NewFromDescr(subtype, dtype, + (int)shape.len, shape.ptr, + NULL, NULL, 0, NULL); + if (shape.ptr) PyDimMem_FREE(shape.ptr); + return ret; + fail: Py_XDECREF(dtype); if (shape.ptr) PyDimMem_FREE(shape.ptr); |