diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-02-27 18:25:29 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-27 18:25:29 (GMT) |
commit | 0dadf56737f591c83d18db5e445960d39448583e (patch) | |
tree | 4c95359c6bab0d9a318ee559e1253cd9bb5d79e9 /Python | |
parent | bc144f0abff2b36595171377ee847c0266596ab2 (diff) | |
download | cpython-0dadf56737f591c83d18db5e445960d39448583e.zip cpython-0dadf56737f591c83d18db5e445960d39448583e.tar.gz cpython-0dadf56737f591c83d18db5e445960d39448583e.tar.bz2 |
bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#349)
Patch by Matthias Bussonnier.
(cherry picked from commit 160edb43571311a3785785c1dfa784afc52d87be)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d323908..62badeb 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); |