summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-07-07 04:03:29 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-07-07 04:03:29 +0000
commitddfe20b98506f0e0eb5f27286dc515ccab4b44a8 (patch)
treee8f77a160e2a01a52aad5d9296116ccbb00f291e
parent3ea289e92d3a53bc296cb6a0a26bcafaee7ca48e (diff)
downloadnumpy-ddfe20b98506f0e0eb5f27286dc515ccab4b44a8.tar.gz
Fix memory leak in #172
-rw-r--r--numpy/core/src/multiarraymodule.c10
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);