[3.9] bpo-40998: Fix a refleak in create_filter() (GH-23365) (GH-23369)

(cherry picked from commit d1e38d4023)
This commit is contained in:
Christian Heimes 2020-11-18 18:45:29 +01:00 committed by GitHub
parent c53c3f4000
commit 35bf8ea7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,11 +69,14 @@ create_filter(PyObject *category, _Py_Identifier *id, const char *modname)
}
} else {
modname_obj = Py_None;
Py_INCREF(modname_obj);
}
/* This assumes the line number is zero for now. */
return PyTuple_Pack(5, action_str, Py_None,
category, modname_obj, _PyLong_Zero);
PyObject *filter = PyTuple_Pack(5, action_str, Py_None,
category, modname_obj, _PyLong_Zero);
Py_DECREF(modname_obj);
return filter;
}
#endif