diff Python/pythonrun.c @ 9965:c1091e82e5aa legacy-trunk

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.
author Barry Warsaw <barry@python.org>
date Wed, 27 Jan 1999 16:39:40 +0000
parents bd1ce4120e6f
children caf2c65a6bcf
line wrap: on
line diff
--- a/Python/pythonrun.c	Wed Jan 27 16:33:19 1999 +0000
+++ b/Python/pythonrun.c	Wed Jan 27 16:39:40 1999 +0000
@@ -992,13 +992,14 @@
 		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";