diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2017-02-27 17:41:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-27 17:41:21 (GMT) |
commit | 7accf2033d03025cc5324f8b9d22582bca3623e9 (patch) | |
tree | 6887826dbec37777dd035fe8e75e713da7b0fec8 /Python | |
parent | bb59d89ceeb1abfb4d73c7fc60b534e4464adf35 (diff) | |
download | cpython-7accf2033d03025cc5324f8b9d22582bca3623e9.zip cpython-7accf2033d03025cc5324f8b9d22582bca3623e9.tar.gz cpython-7accf2033d03025cc5324f8b9d22582bca3623e9.tar.bz2 |
bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#348)
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 c9e9c32..8366735 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2857,13 +2857,16 @@ _PyEval_EvalFrameDefault(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; } err = import_all_from(locals, from); |