From a3b6af3889072c56e6fbbfd79b2c960a05100d91 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Sat, 25 Feb 2017 21:58:05 -0800 Subject: [PATCH] bpo-29655: Fixed possible reference leaks in `import *`. (#301) Patch by Matthias Bussonnier. (cherry picked from commit 160edb43571311a3785785c1dfa784afc52d87be) --- Python/ceval.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index d3239089284c48..62badebca6502d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2832,13 +2832,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) TARGET(IMPORT_STAR) { PyObject *from = POP(), *locals; int err; - if (PyFrame_FastToLocalsWithError(f) < 0) + if (PyFrame_FastToLocalsWithError(f) < 0) { + Py_DECREF(from); goto error; + } locals = f->f_locals; if (locals == NULL) { PyErr_SetString(PyExc_SystemError, "no locals found during 'import *'"); + Py_DECREF(from); goto error; } READ_TIMESTAMP(intr0);