From: Barry Warsaw Date: Wed, 27 Jan 1999 16:39:40 +0000 (+0000) Subject: err_input(): Nailed a small memory leak. If the error is E_INTR, the X-Git-Tag: v1.5.2b2~263 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c80baa3365d0c87f419020e3e1f0488d8bae8eb5;p=thirdparty%2FPython%2Fcpython.git err_input(): Nailed a small memory leak. If the error is E_INTR, the v temporary variable was never decref'd. Test this by starting up the interpreter, hitting C-c, then immediately exiting. Same potential leak can occur if error is E_NOMEM, since the return is done in the case block. Added Py_XDECREF(v); to both blocks, just before the return. --- diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 78c56247fac4..6948829418cf 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -992,13 +992,14 @@ err_input(err) break; case E_TOKEN: msg = "invalid token"; - break; case E_INTR: PyErr_SetNone(PyExc_KeyboardInterrupt); + Py_XDECREF(v); return; case E_NOMEM: PyErr_NoMemory(); + Py_XDECREF(v); return; case E_EOF: msg = "unexpected EOF while parsing";