diff options
author | Georg Brandl <georg@python.org> | 2006-03-17 19:03:25 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-03-17 19:03:25 (GMT) |
commit | 5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa (patch) | |
tree | 26fd8d333d8b7fdde9e4b4bb2c39082d9a3d29d0 /Modules/ossaudiodev.c | |
parent | a5a0704942fcd422f817c9b34e77a2346ddcf102 (diff) | |
download | cpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.zip cpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.tar.gz cpython-5c170fd4a9d2bc2e475d718cbbce526cad4a3eaa.tar.bz2 |
Fix some missing checks after PyTuple_New, PyList_New, PyDict_New
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r-- | Modules/ossaudiodev.c | 16 |
1 files changed, 12 insertions, 4 deletions
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; } |