]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix refleaks
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 11 Aug 2007 04:58:43 +0000 (04:58 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 11 Aug 2007 04:58:43 +0000 (04:58 +0000)
Modules/parsermodule.c

index efc7176eaadaed9b8ed891fc3e4b9bba09a2d593..66d17b7dc73c4dd344ba27645b12b64d6158fc17 100644 (file)
@@ -695,6 +695,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
                              " found %s",
                              Py_Type(temp)->tp_name);
                 Py_DECREF(temp);
+                Py_DECREF(elem);
                 return 0;
             }
             if (len == 3) {
@@ -709,6 +710,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
                                     Py_Type(temp)->tp_name);
                         Py_DECREF(o);
                         Py_DECREF(temp);
+                        Py_DECREF(elem);
                         return 0;
                     }
                     Py_DECREF(o);
@@ -733,10 +735,12 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
         }
         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");