diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/arraymodule.c | 11 | ||||
-rw-r--r-- | Modules/cStringIO.c | 1 | ||||
-rw-r--r-- | Modules/zipimport.c | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c index 0e78e65..f8c4918 100644 --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1826,10 +1826,13 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_DECREF(v); } } else if (initial != NULL && PyString_Check(initial)) { - PyObject *t_initial = PyTuple_Pack(1, - initial); - PyObject *v = - array_fromstring((arrayobject *)a, + PyObject *t_initial, *v; + t_initial = PyTuple_Pack(1, initial); + if (t_initial == NULL) { + Py_DECREF(a); + return NULL; + } + v = array_fromstring((arrayobject *)a, t_initial); Py_DECREF(t_initial); if (v == NULL) { diff --git a/Modules/cStringIO.c b/Modules/cStringIO.c index e891114..81b9ac8 100644 --- a/Modules/cStringIO.c +++ b/Modules/cStringIO.c @@ -541,6 +541,7 @@ newOobject(int size) { UNLESS (self->buf = (char *)malloc(size)) { PyErr_SetString(PyExc_MemoryError,"out of memory"); self->buf_size = 0; + Py_DECREF(self); return NULL; } diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 3a902cd..2dc5048 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1165,6 +1165,8 @@ initzipimport(void) mod = Py_InitModule4("zipimport", NULL, zipimport_doc, NULL, PYTHON_API_VERSION); + if (mod == NULL) + return; ZipImportError = PyErr_NewException("zipimport.ZipImportError", PyExc_ImportError, NULL); |