diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-11-20 10:16:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-20 10:16:02 (GMT) |
commit | 2ea4c37c1ecf05a8495211d55ed6888439b1b9cf (patch) | |
tree | 68df5ec2180ca4592ddcb7e1a310392512f638d6 /Python | |
parent | 132243957ce834cf5ffced4bf8e39d00f6e34e5f (diff) | |
download | cpython-2ea4c37c1ecf05a8495211d55ed6888439b1b9cf.zip cpython-2ea4c37c1ecf05a8495211d55ed6888439b1b9cf.tar.gz cpython-2ea4c37c1ecf05a8495211d55ed6888439b1b9cf.tar.bz2 |
bpo-38823: Fix refleak in marshal init error path (GH-17260)
(cherry picked from commit 33b671e72450bf4b5a946ce0dde6b7fe21150108)
Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
Diffstat (limited to 'Python')
-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 b2daff2c..c6a06e8 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; } |