[Numpy-svn] r2764 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Fri Jul 7 00:03:33 EDT 2006


Author: oliphant
Date: 2006-07-06 23:03:29 -0500 (Thu, 06 Jul 2006)
New Revision: 2764

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Fix memory leak in #172

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-07-06 21:41:57 UTC (rev 2763)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-07-07 04:03:29 UTC (rev 2764)
@@ -5814,6 +5814,7 @@
 array__reconstruct(PyObject *dummy, PyObject *args) 
 {
 
+	PyObject *ret;
 	PyTypeObject *subtype;
 	PyArray_Dims shape = {NULL, 0};
 	PyArray_Descr *dtype=NULL;
@@ -5829,9 +5830,12 @@
 		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);




More information about the Numpy-svn mailing list