From 667e31d72ab85f903878b0ba57a19ee8cfbefe1d Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 27 Jan 1999 16:39:40 +0000 Subject: 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. --- Python/pythonrun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Python/pythonrun.c') diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 78c56247fa..6948829418 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"; -- cgit v1.2.1