diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2020-03-02 20:05:08 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 20:05:08 (GMT) |
commit | 2d2f85517f8216146a2f888d1ad4d765b3be2339 (patch) | |
tree | 06b3f2306d63b292eb6a49e5772d295ae6eed4ce /Python | |
parent | 89aa4694fc8c6d190325ef8ed6ce6a6b8efb3e50 (diff) | |
download | cpython-2d2f85517f8216146a2f888d1ad4d765b3be2339.zip cpython-2d2f85517f8216146a2f888d1ad4d765b3be2339.tar.gz cpython-2d2f85517f8216146a2f888d1ad4d765b3be2339.tar.bz2 |
bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 9ea81bb..92378fa 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -859,11 +859,11 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, int rc; if (PyErr_Occurred()) { - return 0; + goto handle_error; } *registry = PyDict_New(); if (*registry == NULL) - return 0; + goto handle_error; rc = _PyDict_SetItemId(globals, &PyId___warningregistry__, *registry); if (rc < 0) @@ -893,6 +893,7 @@ setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, dangling reference. */ Py_XDECREF(*registry); Py_XDECREF(*module); + Py_XDECREF(*filename); return 0; } |