[Scipy-svn] r3069 - trunk/Lib/ndimage/src
scipy-svn@scip...
scipy-svn@scip...
Sat Jun 2 17:12:47 CDT 2007
Author: stefan
Date: 2007-06-02 17:12:32 -0500 (Sat, 02 Jun 2007)
New Revision: 3069
Modified:
trunk/Lib/ndimage/src/nd_image.c
Log:
Ensure clean memory de-allocation in Py_Histogram.
Modified: trunk/Lib/ndimage/src/nd_image.c
===================================================================
--- trunk/Lib/ndimage/src/nd_image.c 2007-06-01 12:09:10 UTC (rev 3068)
+++ trunk/Lib/ndimage/src/nd_image.c 2007-06-02 22:12:32 UTC (rev 3069)
@@ -1088,7 +1088,9 @@
&max_label, &n_results))
goto exit;
- histograms = (PyArrayObject**)malloc(input->nd * n_results *
+ /* Set all pointers to NULL, so that freeing the memory */
+ /* doesn't cause problems. */
+ histograms = (PyArrayObject**)calloc(input->nd * n_results,
sizeof(PyArrayObject*));
if (!histograms) {
PyErr_NoMemory();
More information about the Scipy-svn
mailing list