diff options
author | Barry Warsaw <barry@python.org> | 1999-01-27 16:39:40 +0000 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 1999-01-27 16:39:40 +0000 |
commit | 667e31d72ab85f903878b0ba57a19ee8cfbefe1d (patch) | |
tree | 2c8c4464180ce32f1e884e7014026f6de382add6 /Python/pythonrun.c | |
parent | b2fd675508dd4ff71f8bae5accf0da1ba13f3df7 (diff) | |
download | cpython-667e31d72ab85f903878b0ba57a19ee8cfbefe1d.tar.gz |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
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"; |