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

numpy-svn at scipy.org numpy-svn at scipy.org
Wed Sep 6 00:56:41 CDT 2006


Author: oliphant
Date: 2006-09-06 00:56:32 -0500 (Wed, 06 Sep 2006)
New Revision: 3124

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Fix memory leak in corner case of lexsort.

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-09-06 03:19:32 UTC (rev 3123)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-09-06 05:56:32 UTC (rev 3124)
@@ -2414,9 +2414,10 @@
 						   mps[0]->dimensions,
 						   PyArray_INTP,
 						   NULL, NULL, 0, 0, NULL);
-		if (ret == NULL) return NULL;
+                
+		if (ret == NULL) goto fail;
 		*((intp *)(ret->data)) = 0;
-		return (PyObject *)ret;
+                goto finish;
 	}
 	if (axis < 0) axis += nd;
 	if ((axis < 0) || (axis >= nd)) {
@@ -2502,8 +2503,9 @@
 
 	NPY_END_THREADS
 
+ finish:
 	for (i=0; i<n; i++) {Py_XDECREF(mps[i]); Py_XDECREF(its[i]);}
-	Py_DECREF(rit);
+	Py_XDECREF(rit);
 	_pya_free(mps);
 	_pya_free(its);
 	return (PyObject *)ret;



More information about the Numpy-svn mailing list