Skip to content

Commit

Permalink
bpo-38823: Fix refleak in marshal init error path (pythonGH-17260)
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher authored and vstinner committed Nov 20, 2019
1 parent 2e96906 commit 33b671e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Python/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 33b671e

Please sign in to comment.