summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/libffi/src/x86/ffi_darwin.c2
-rw-r--r--Modules/_elementtree.c10
-rw-r--r--Modules/_struct.c3
-rw-r--r--Modules/itertoolsmodule.c7
-rw-r--r--Modules/main.c1
-rw-r--r--Modules/zipimport.c2
6 files changed, 19 insertions, 6 deletions
diff --git a/Modules/_ctypes/libffi/src/x86/ffi_darwin.c b/Modules/_ctypes/libffi/src/x86/ffi_darwin.c
index c9742d8..71ac587 100644
--- a/Modules/_ctypes/libffi/src/x86/ffi_darwin.c
+++ b/Modules/_ctypes/libffi/src/x86/ffi_darwin.c
@@ -217,7 +217,7 @@ extern void ffi_call_STDCALL(void (*)(char *, extended_cif *),
#endif /* X86_WIN32 */
void ffi_call(/*@dependent@*/ ffi_cif *cif,
- void (*fn)(),
+ void (*fn)(void),
/*@out@*/ void *rvalue,
/*@dependent@*/ void **avalue)
{
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index 97297b8..d237cbb 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -348,7 +348,17 @@ element_resize(ElementObject* self, int extra)
if (size > self->extra->allocated) {
/* use Python 2.4's list growth strategy */
size = (size >> 3) + (size < 9 ? 3 : 6) + size;
+ /* Coverity CID #182 size_error: Allocating 1 bytes to pointer "children"
+ * which needs at least 4 bytes.
+ * Although it's a false alarm always assume at least one child to
+ * be safe.
+ */
+ size = size ? size : 1;
if (self->extra->children != self->extra->_children) {
+ /* Coverity CID #182 size_error: Allocating 1 bytes to pointer
+ * "children", which needs at least 4 bytes. Although it's a
+ * false alarm always assume at least one child to be safe.
+ */
children = PyObject_Realloc(self->extra->children,
size * sizeof(PyObject*));
if (!children)
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 278b035..dcf315e 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1918,8 +1918,7 @@ PyDoc_STRVAR(clearcache_doc,
static PyObject *
clearcache(PyObject *self)
{
- if (cache != NULL)
- PyDict_Clear(cache);
+ Py_CLEAR(cache);
Py_RETURN_NONE;
}
diff --git a/Modules/itertoolsmodule.c b/Modules/itertoolsmodule.c
index 132acc5..d35c6b9 100644
--- a/Modules/itertoolsmodule.c
+++ b/Modules/itertoolsmodule.c
@@ -1356,10 +1356,11 @@ starmap_next(starmapobject *lz)
if (args == NULL)
return NULL;
if (!PyTuple_CheckExact(args)) {
+ PyObject *newargs = PySequence_Tuple(args);
Py_DECREF(args);
- PyErr_SetString(PyExc_TypeError,
- "iterator must return a tuple");
- return NULL;
+ if (newargs == NULL)
+ return NULL;
+ args = newargs;
}
result = PyObject_Call(lz->func, args, NULL);
Py_DECREF(args);
diff --git a/Modules/main.c b/Modules/main.c
index 87462a0..ce05431 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -533,6 +533,7 @@ Py_Main(int argc, char **argv)
if (fstat(fileno(fp), &sb) == 0 &&
S_ISDIR(sb.st_mode)) {
fprintf(stderr, "%s: '%s' is a directory, cannot continue\n", argv[0], filename);
+ fclose(fp);
return 1;
}
}
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 84985a8..cd56be3 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -1000,6 +1000,8 @@ parse_dostime(int dostime, int dosdate)
{
struct tm stm;
+ memset((void *) &stm, '\0', sizeof(stm));
+
stm.tm_sec = (dostime & 0x1f) * 2;
stm.tm_min = (dostime >> 5) & 0x3f;
stm.tm_hour = (dostime >> 11) & 0x1f;