Skip to content

Commit 160edb4

Browse files
Carreauserhiy-storchaka
authored andcommitted
bpo-29655: Fixed possible reference leaks in import *. (#301)
Patch by Matthias Bussonnier.
1 parent 53c1892 commit 160edb4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/ceval.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -2810,13 +2810,16 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
28102810
TARGET(IMPORT_STAR) {
28112811
PyObject *from = POP(), *locals;
28122812
int err;
2813-
if (PyFrame_FastToLocalsWithError(f) < 0)
2813+
if (PyFrame_FastToLocalsWithError(f) < 0) {
2814+
Py_DECREF(from);
28142815
goto error;
2816+
}
28152817

28162818
locals = f->f_locals;
28172819
if (locals == NULL) {
28182820
PyErr_SetString(PyExc_SystemError,
28192821
"no locals found during 'import *'");
2822+
Py_DECREF(from);
28202823
goto error;
28212824
}
28222825
err = import_all_from(locals, from);

0 commit comments

Comments
 (0)