From 64e2f9ac86b0f7aade2fe331136beceee975fc91 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 22 Nov 2016 11:50:40 -0800 Subject: [PATCH] Issue #27100: Fix ref leak --- Python/ceval.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index ebf073a87fb..83296f637fc 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3138,8 +3138,10 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) if (enter == NULL) goto error; exit = special_lookup(mgr, &PyId___exit__); - if (exit == NULL) + if (exit == NULL) { + Py_DECREF(enter); goto error; + } SET_TOP(exit); Py_DECREF(mgr); res = PyObject_CallFunctionObjArgs(enter, NULL);