diff options
author | Georg Brandl <georg@python.org> | 2008-07-19 10:08:55 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-07-19 10:08:55 (GMT) |
commit | 1ad108db05b86b426b636edc0814be4f8e6ba0d5 (patch) | |
tree | 4ccdd3fcd32b5f27a8fcf70e153c5b8f513fb34a /Python | |
parent | 3369167089cb2390b16ced87a0c54a3678342e83 (diff) | |
download | cpython-1ad108db05b86b426b636edc0814be4f8e6ba0d5.zip cpython-1ad108db05b86b426b636edc0814be4f8e6ba0d5.tar.gz cpython-1ad108db05b86b426b636edc0814be4f8e6ba0d5.tar.bz2 |
#3378: in case of no memory, don't leak even more memory. :)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index caa7ba8..bd4f494 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1553,10 +1553,10 @@ err_input(perrdetail *err) case E_INTR: if (!PyErr_Occurred()) PyErr_SetNone(PyExc_KeyboardInterrupt); - return; + goto cleanup; case E_NOMEM: PyErr_NoMemory(); - return; + goto cleanup; case E_EOF: msg = "unexpected EOF while parsing"; break; @@ -1601,10 +1601,6 @@ err_input(perrdetail *err) } v = Py_BuildValue("(ziiz)", err->filename, err->lineno, err->offset, err->text); - if (err->text != NULL) { - PyObject_FREE(err->text); - err->text = NULL; - } w = NULL; if (v != NULL) w = Py_BuildValue("(sO)", msg, v); @@ -1612,6 +1608,11 @@ err_input(perrdetail *err) Py_XDECREF(v); PyErr_SetObject(errtype, w); Py_XDECREF(w); +cleanup: + if (err->text != NULL) { + PyObject_FREE(err->text); + err->text = NULL; + } } /* Print fatal error message and abort */ |