[Python-checkins] bpo-38823: Fix refleak in marshal init error path (GH-17260)
Victor Stinner
webhook-mailer at python.org
Tue Nov 19 19:59:41 EST 2019
https://github.com/python/cpython/commit/33b671e72450bf4b5a946ce0dde6b7fe21150108
commit: 33b671e72450bf4b5a946ce0dde6b7fe21150108
branch: master
author: Brandt Bucher <brandtbucher at gmail.com>
committer: Victor Stinner <vstinner at python.org>
date: 2019-11-20T01:59:32+01:00
summary:
bpo-38823: Fix refleak in marshal init error path (GH-17260)
files:
M Python/marshal.c
diff --git a/Python/marshal.c b/Python/marshal.c
index cb11c8c74ef3a..ec6b3dadc02ca 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1829,6 +1829,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