summaryrefslogtreecommitdiffstats
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-01-27 16:39:40 (GMT)
committerBarry Warsaw <barry@python.org>1999-01-27 16:39:40 (GMT)
commitc80baa3365d0c87f419020e3e1f0488d8bae8eb5 (patch)
tree873de298333235cd6f2b44cdd8deab4d652f227d /Python/pythonrun.c
parent54892c4b2cac50cc698be2ebede663b781cf4a37 (diff)
downloadcpython-c80baa3365d0c87f419020e3e1f0488d8bae8eb5.zip
cpython-c80baa3365d0c87f419020e3e1f0488d8bae8eb5.tar.gz
cpython-c80baa3365d0c87f419020e3e1f0488d8bae8eb5.tar.bz2
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.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r--Python/pythonrun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 78c5624..6948829 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";