Skip to content

Commit 33b671e

Browse files
brandtbuchervstinner
authored andcommitted
bpo-38823: Fix refleak in marshal init error path (GH-17260)
1 parent 2e96906 commit 33b671e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Python/marshal.c

+4-1
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)