From: Berker Peksag Date: Mon, 27 Feb 2017 18:25:29 +0000 (+0300) Subject: bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#349) X-Git-Tag: v3.5.4rc1~316 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0dadf56737f591c83d18db5e445960d39448583e;p=python bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#349) Patch by Matthias Bussonnier. (cherry picked from commit 160edb43571311a3785785c1dfa784afc52d87be) --- diff --git a/Python/ceval.c b/Python/ceval.c index d323908928..62badebca6 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);