Revision: 7060
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7060&view=rev
Author:   mdboom
Date:     2009-04-23 14:22:11 +0000 (Thu, 23 Apr 2009)

Log Message:
-----------
Fix theoretical memory leak.

Modified Paths:
--------------
    trunk/matplotlib/src/agg_py_path_iterator.h

Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2009-04-23 14:21:52 UTC (rev 
7059)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2009-04-23 14:22:11 UTC (rev 
7060)
@@ -52,6 +52,8 @@
         if (!m_vertices ||
             PyArray_DIM(m_vertices, 1) != 2)
         {
+            Py_XDECREF(m_vertices);
+            m_vertices = NULL;
             throw Py::ValueError("Invalid vertices array.");
         }
 
@@ -59,10 +61,18 @@
         {
             m_codes = (PyArrayObject*)PyArray_FromObject
                       (codes_obj.ptr(), PyArray_UINT8, 1, 1);
-            if (!m_codes)
+            if (!m_codes) {
+                Py_XDECREF(m_vertices);
+                m_vertices = NULL;
                 throw Py::ValueError("Invalid codes array.");
-            if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 0))
+            }
+            if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 0)) {
+                Py_XDECREF(m_vertices);
+                m_vertices = NULL;
+                Py_XDECREF(m_codes);
+                m_codes = NULL;
                 throw Py::ValueError("Codes array is wrong length");
+            }
         }
 
         m_should_simplify    = should_simplify_obj.isTrue();


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to