diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/almodule.c | 4 | ||||
-rw-r--r-- | Modules/gcmodule.c | 2 | ||||
-rw-r--r-- | Modules/ossaudiodev.c | 16 | ||||
-rw-r--r-- | Modules/pyexpat.c | 2 |
4 files changed, 19 insertions, 5 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c index 5254fca..fbeb13a 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -1482,7 +1482,8 @@ al_GetParams(PyObject *self, PyObject *args) } if (alGetParams(resource, pvs, npvs) < 0) goto error; - v = PyList_New(npvs); + if (!(v = PyList_New(npvs))) + goto error; for (i = 0; i < npvs; i++) { if (pvs[i].sizeOut < 0) { char buf[32]; @@ -1692,6 +1693,7 @@ al_GetParamInfo(PyObject *self, PyObject *args) if (alGetParamInfo(res, param, &pinfo) < 0) return NULL; v = PyDict_New(); + if (!v) return NULL; item = PyInt_FromLong((long) pinfo.resource); PyDict_SetItemString(v, "resource", item); diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c index 7e3f95a..3d49f6c 100644 --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -1085,6 +1085,8 @@ gc_get_referrers(PyObject *self, PyObject *args) { int i; PyObject *result = PyList_New(0); + if (!result) return NULL; + for (i = 0; i < NUM_GENERATIONS; i++) { if (!(gc_referrers_for(args, GEN_HEAD(i), result))) { Py_DECREF(result); diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index ce8a0d0..563620c 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -935,24 +935,32 @@ build_namelists (PyObject *module) labels = PyList_New(num_controls); names = PyList_New(num_controls); + if (labels == NULL || names == NULL) + goto error2; for (i = 0; i < num_controls; i++) { s = PyString_FromString(control_labels[i]); if (s == NULL) - return -1; + goto error2; PyList_SET_ITEM(labels, i, s); s = PyString_FromString(control_names[i]); if (s == NULL) - return -1; + goto error2; PyList_SET_ITEM(names, i, s); } if (PyModule_AddObject(module, "control_labels", labels) == -1) - return -1; + goto error2; if (PyModule_AddObject(module, "control_names", names) == -1) - return -1; + goto error1; return 0; + +error2: + Py_XDECREF(labels); +error1: + Py_XDECREF(names); + return -1; } diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index e4bf180..b6e927d 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1519,6 +1519,8 @@ xmlparse_getattr(xmlparseobject *self, char *name) if (strcmp(name, "__members__") == 0) { int i; PyObject *rc = PyList_New(0); + if (!rc) + return NULL; for (i = 0; handler_info[i].name != NULL; i++) { PyObject *o = get_handler_name(&handler_info[i]); if (o != NULL) |