Author: ArcRiley
Date: 2009-03-04 03:04:21 -0500 (Wed, 04 Mar 2009)
New Revision: 1549

Modified:
   trunk/concordance/src/_core/step.c
Log:
properly destroys a TreeBuilder object after it's closed

Modified: trunk/concordance/src/_core/step.c
===================================================================
--- trunk/concordance/src/_core/step.c  2009-03-04 08:04:14 UTC (rev 1548)
+++ trunk/concordance/src/_core/step.c  2009-03-04 08:04:21 UTC (rev 1549)
@@ -76,7 +76,6 @@
         Convert a C string and its length to a Python unicode object. If the
         C string pointer is NULL, the length is ignored and None is returned.
   */
-
   switch (pmsg->type) {
     case CONCORD_MT_XMLSTART : {                                          /*\
       cdef :                                                              \*/
@@ -106,10 +105,17 @@
 
          decref return value since we don't want/need it yet.      
       */
-      Py_DECREF(PyEval_CallMethod(*msg->tree, "start", "(UO)", msg->name, 
atts));
+      temp = PyEval_CallMethod(*msg->tree, "start", "(UO)", msg->name, atts);
 
       /* remove local reference to attr dict */
       Py_DECREF(atts);
+
+      /* check to ensure the method returned ok */
+      if (!temp) 
+        BREAKNULL
+
+      /* decref return value since we don't want/need it yet */
+      Py_DECREF(temp);
       break;
     }
 
@@ -149,6 +155,10 @@
       temp = PyEval_CallMethod(*msg->tree, "close", "()");
       if (!temp)
         BREAKNULL;
+
+      /* discard old TreeBuilder */
+      Py_DECREF(*msg->tree);
+      *msg->tree = NULL;
       
       output = PyEval_CallMethod(msg->self, "xml", "(O)", temp);
       if (!output)

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to