From 1ac754fa10f5d199d19911e21185d0970cb3073f Mon Sep 17 00:00:00 2001 From: Neal Norwitz Date: Thu, 19 Jan 2006 06:09:39 +0000 Subject: Check return result from Py_InitModule*(). This API can fail. Probably should be backported. --- PC/_subprocess.c | 2 ++ PC/_winreg.c | 2 ++ PC/msvcrtmodule.c | 2 ++ PC/winsound.c | 2 ++ 4 files changed, 8 insertions(+) (limited to 'PC') diff --git a/PC/_subprocess.c b/PC/_subprocess.c index 8ed4899d8c..b675b88462 100644 --- a/PC/_subprocess.c +++ b/PC/_subprocess.c @@ -553,6 +553,8 @@ init_subprocess() sp_handle_as_number.nb_int = (unaryfunc) sp_handle_as_int; m = Py_InitModule("_subprocess", sp_functions); + if (m == NULL) + return; d = PyModule_GetDict(m); /* constants */ diff --git a/PC/_winreg.c b/PC/_winreg.c index 34e4f6895a..965acf1e18 100644 --- a/PC/_winreg.c +++ b/PC/_winreg.c @@ -1459,6 +1459,8 @@ PyMODINIT_FUNC init_winreg(void) { PyObject *m, *d; m = Py_InitModule3("_winreg", winreg_methods, module_doc); + if (m == NULL) + return; d = PyModule_GetDict(m); PyHKEY_Type.ob_type = &PyType_Type; PyHKEY_Type.tp_doc = PyHKEY_doc; diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index 84cf0c132e..4453023a6a 100755 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -221,6 +221,8 @@ PyMODINIT_FUNC initmsvcrt(void) { PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); + if (m == NULL) + return; PyObject *d = PyModule_GetDict(m); /* constants for the locking() function's mode argument */ diff --git a/PC/winsound.c b/PC/winsound.c index b94b322068..81e3917ed6 100644 --- a/PC/winsound.c +++ b/PC/winsound.c @@ -220,6 +220,8 @@ initwinsound(void) PyObject *module = Py_InitModule3("winsound", sound_methods, sound_module_doc); + if (module == NULL) + return; PyObject *dict = PyModule_GetDict(module); ADD_DEFINE(SND_ASYNC); -- cgit v1.2.1