summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Bussonnier <bussonniermatthias@gmail.com>2017-02-26 05:58:05 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-02-26 05:58:05 (GMT)
commit160edb43571311a3785785c1dfa784afc52d87be (patch)
treedc0632b6a3fa173fc111bb5c63306b33f3ff48cd
parent53c1892dc3de1de612b1cf95dc7bf09f82c1babf (diff)
downloadcpython-160edb43571311a3785785c1dfa784afc52d87be.zip
cpython-160edb43571311a3785785c1dfa784afc52d87be.tar.gz
cpython-160edb43571311a3785785c1dfa784afc52d87be.tar.bz2
bpo-29655: Fixed possible reference leaks in `import *`. (#301)
Patch by Matthias Bussonnier.
-rw-r--r--Python/ceval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 0a82965..4022ba2 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2810,13 +2810,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);