[Python-3000-checkins] r56913 - python/branches/py3k/Modules/parsermodule.c

neal.norwitz python-3000-checkins at python.org
Sat Aug 11 06:58:43 CEST 2007


Author: neal.norwitz
Date: Sat Aug 11 06:58:43 2007
New Revision: 56913

Modified:
   python/branches/py3k/Modules/parsermodule.c
Log:
Fix refleaks

Modified: python/branches/py3k/Modules/parsermodule.c
==============================================================================
--- python/branches/py3k/Modules/parsermodule.c	(original)
+++ python/branches/py3k/Modules/parsermodule.c	Sat Aug 11 06:58:43 2007
@@ -695,6 +695,7 @@
                              " found %s",
                              Py_Type(temp)->tp_name);
                 Py_DECREF(temp);
+                Py_DECREF(elem);
                 return 0;
             }
             if (len == 3) {
@@ -709,6 +710,7 @@
 				     Py_Type(temp)->tp_name);
                         Py_DECREF(o);
                         Py_DECREF(temp);
+                        Py_DECREF(elem);
                         return 0;
                     }
                     Py_DECREF(o);
@@ -733,10 +735,12 @@
         }
         err = PyNode_AddChild(root, type, strn, *line_num, 0);
         if (err == E_NOMEM) {
+            Py_XDECREF(elem);
             PyObject_FREE(strn);
             return (node *) PyErr_NoMemory();
         }
         if (err == E_OVERFLOW) {
+            Py_XDECREF(elem);
             PyObject_FREE(strn);
             PyErr_SetString(PyExc_ValueError,
                             "unsupported number of child nodes");


More information about the Python-3000-checkins mailing list