10000 bpo-38823: Fix refleak in marshal init error path (GH-17260) · miss-islington/cpython@7187ee0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7187ee0

Browse files
brandtbuchermiss-islington
authored andcommitted
bpo-38823: Fix refleak in marshal init error path (pythonGH-17260)
(cherry picked from commit 33b671e) Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
1 parent 1322439 commit 7187ee0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/marshal.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1829,6 +1829,9 @@ PyMarshal_Init(void)
18291829
PyObject *mod = PyModule_Create(&marshalmodule);
18301830
if (mod == NULL)
18311831
return NULL;
1832-
PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION);
1832+
if (PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION) < 0) {
1833+
Py_DECREF(mod);
1834+
return NULL;
1835+
}
18331836
return mod;
18341837
}

0 commit comments

Comments
 (0)
0