Mercurial > cpython-lru_cache-weakref
diff Python/ast.c @ 36000:cc3261597136 legacy-trunk
SF #1370197, memory leak - ast_error_finish (in error conditions).
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 11 Dec 2005 20:08:33 +0000 |
| parents | c89707daa011 |
| children | 6321669f2f4d |
line wrap: on
line diff
--- a/Python/ast.c Sat Dec 10 18:50:16 2005 +0000 +++ b/Python/ast.c Sun Dec 11 20:08:33 2005 +0000 @@ -179,8 +179,10 @@ return; Py_INCREF(errstr); lineno = PyInt_AsLong(PyTuple_GetItem(value, 1)); - if (lineno == -1) + if (lineno == -1) { + Py_DECREF(errstr); return; + } Py_DECREF(value); loc = PyErr_ProgramText(filename, lineno); @@ -190,8 +192,10 @@ } tmp = Py_BuildValue("(ziOO)", filename, lineno, Py_None, loc); Py_DECREF(loc); - if (!tmp) + if (!tmp) { + Py_DECREF(errstr); return; + } value = Py_BuildValue("(OO)", errstr, tmp); Py_DECREF(errstr); Py_DECREF(tmp);
