[Numpy-svn] r8468 - trunk/numpy/core/src/multiarray

numpy-svn@scip... numpy-svn@scip...
Wed Jun 30 15:40:46 CDT 2010


Author: oliphant
Date: 2010-06-30 15:40:46 -0500 (Wed, 30 Jun 2010)
New Revision: 8468

Modified:
   trunk/numpy/core/src/multiarray/multiarraymodule.c
Log:
Fix memory-leak on dtype's found by Lisandro Dalcin.

Modified: trunk/numpy/core/src/multiarray/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarray/multiarraymodule.c	2010-06-29 17:57:15 UTC (rev 8467)
+++ trunk/numpy/core/src/multiarray/multiarraymodule.c	2010-06-30 20:40:46 UTC (rev 8468)
@@ -1863,7 +1863,7 @@
 
 static PyObject *
 array_arange(PyObject *NPY_UNUSED(ignored), PyObject *args, PyObject *kws) {
-    PyObject *o_start = NULL, *o_stop = NULL, *o_step = NULL;
+    PyObject *o_start = NULL, *o_stop = NULL, *o_step = NULL, *range=NULL;
     static char *kwd[]= {"start", "stop", "step", "dtype", NULL};
     PyArray_Descr *typecode = NULL;
 
@@ -1873,7 +1873,9 @@
         Py_XDECREF(typecode);
         return NULL;
     }
-    return PyArray_ArangeObj(o_start, o_stop, o_step, typecode);
+    range = PyArray_ArangeObj(o_start, o_stop, o_step, typecode);
+    Py_XDECREF(typecode);
+    return range; 
 }
 
 /*NUMPY_API



More information about the Numpy-svn mailing list