bpo-29655: Fixed possible reference leaks in import *. (#301) (#349) · python/cpython@0dadf56 (original) (raw)

Original file line number Diff line number Diff line change
@@ -2832,13 +2832,16 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
2832 2832 TARGET(IMPORT_STAR) {
2833 2833 PyObject *from = POP(), *locals;
2834 2834 int err;
2835 -if (PyFrame_FastToLocalsWithError(f) < 0)
2835 +if (PyFrame_FastToLocalsWithError(f) < 0) {
2836 +Py_DECREF(from);
2836 2837 goto error;
2838 + }
2837 2839
2838 2840 locals = f->f_locals;
2839 2841 if (locals == NULL) {
2840 2842 PyErr_SetString(PyExc_SystemError,
2841 2843 "no locals found during 'import *'");
2844 +Py_DECREF(from);
2842 2845 goto error;
2843 2846 }
2844 2847 READ_TIMESTAMP(intr0);