Mercurial > cpython-lru_cache-weakref
diff Modules/parsermodule.c @ 42535:8d6867cb8a8d
Fix refleaks
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 11 Aug 2007 04:58:43 +0000 |
| parents | e70cdce0e8b2 |
| children | f3b3ffd13954 |
line wrap: on
line diff
--- a/Modules/parsermodule.c Sat Aug 11 04:58:26 2007 +0000 +++ b/Modules/parsermodule.c Sat Aug 11 04:58:43 2007 +0000 @@ -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");
