[Python-checkins] bpo-38823: Fix refleak in marshal init error path (GH-17260)
Miss Islington (bot)
webhook-mailer at python.org
Wed Nov 20 05:15:26 EST 2019
https://github.com/python/cpython/commit/63f09e7628bd72f1bb2106226655b1f775757806
commit: 63f09e7628bd72f1bb2106226655b1f775757806
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-11-20T02:15:22-08:00
summary:
bpo-38823: Fix refleak in marshal init error path (GH-17260)
(cherry picked from commit 33b671e72450bf4b5a946ce0dde6b7fe21150108)
Co-authored-by: Brandt Bucher <brandtbucher at gmail.com>
files:
M Python/marshal.c
diff --git a/Python/marshal.c b/Python/marshal.c
index 7d60614e712ae..2e911b7be2759 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1860,6 +1860,9 @@ PyMarshal_Init(void)
PyObject *mod = PyModule_Create(&marshalmodule);
if (mod == NULL)
return NULL;
- PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION);
+ if (PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION) < 0) {
+ Py_DECREF(mod);
+ return NULL;
+ }
return mod;
}
More information about the Python-checkins
mailing list