diff options
author | Brandt Bucher <brandtbucher@gmail.com> | 2019-11-19 16:59:32 -0800 |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2019-11-20 01:59:32 +0100 |
commit | 33b671e72450bf4b5a946ce0dde6b7fe21150108 (patch) | |
tree | 03330a9cdc791d524c202de6f8d19c58f3a2c47a /Python/marshal.c | |
parent | 2e96906da764402b4c8062dbf99171ca506f9e12 (diff) | |
download | cpython-git-33b671e72450bf4b5a946ce0dde6b7fe21150108.tar.gz |
bpo-38823: Fix refleak in marshal init error path (GH-17260)
Diffstat (limited to 'Python/marshal.c')
-rw-r--r-- | Python/marshal.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/marshal.c b/Python/marshal.c index cb11c8c74e..ec6b3dadc0 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; } |