widl: xmalloc shouldn't initialize to zero, do that explicitly where needed.
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 2c1e029..ead02cb 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -1144,6 +1144,7 @@
t->sign = 0;
t->defined = FALSE;
t->written = FALSE;
+ t->user_types_registered = FALSE;
t->typelib_idx = -1;
INIT_LINK(t);
return t;
@@ -1203,6 +1204,7 @@
v->name = name;
v->ptr_level = 0;
v->type = NULL;
+ v->args = NULL;
v->tname = NULL;
v->attrs = NULL;
v->array = NULL;
diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c
index 7a1b246..5218070 100644
--- a/tools/widl/typelib.c
+++ b/tools/widl/typelib.c
@@ -220,6 +220,8 @@
typelib->name = xstrdup(name);
typelib->filename = xstrdup(typelib_name);
typelib->attrs = attrs;
+ typelib->entry = NULL;
+ typelib->importlibs = NULL;
}
void end_typelib(void)
@@ -373,6 +375,7 @@
importlib->importinfos[i].flags |= MSFT_IMPINFO_OFFSET_IS_GUID;
msft_read_guid(fd, &segdir, base.posguid, &importlib->importinfos[i].guid);
}
+ else memset( &importlib->importinfos[i].guid, 0, sizeof(importlib->importinfos[i].guid));
tlb_lseek(fd, segdir.pNametab.offset + base.NameOffset);
tlb_read(fd, &nameintro, sizeof(nameintro));
@@ -431,6 +434,7 @@
chat("add_importlib: %s\n", name);
importlib = xmalloc(sizeof(*importlib));
+ memset( importlib, 0, sizeof(*importlib) );
importlib->name = xstrdup(name);
read_importlib(importlib);
diff --git a/tools/widl/utils.c b/tools/widl/utils.c
index 9f82184..fea0540 100644
--- a/tools/widl/utils.c
+++ b/tools/widl/utils.c
@@ -145,7 +145,7 @@
namelen = strlen(name);
/* +4 for later extension and +1 for '\0' */
- base = (char *)xmalloc(namelen +4 +1);
+ base = xmalloc(namelen +4 +1);
strcpy(base, name);
if(!strcasecmp(name + namelen-extlen, ext))
{
@@ -164,12 +164,7 @@
{
error("Virtual memory exhausted.\n");
}
- /*
- * We set it to 0.
- * This is *paramount* because we depend on it
- * just about everywhere in the rest of the code.
- */
- memset(res, 0, size);
+ memset(res, 0x55, size);
return res;
}
@@ -192,6 +187,6 @@
char *s;
assert(str != NULL);
- s = (char *)xmalloc(strlen(str)+1);
+ s = xmalloc(strlen(str)+1);
return strcpy(s, str);
}
diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h
index cf0f246..eeaa627 100644
--- a/tools/widl/widltypes.h
+++ b/tools/widl/widltypes.h
@@ -49,7 +49,7 @@
type *l_next; \
type *l_prev
-#define LINK(x,y) do { x->l_next = y; if (y) y->l_prev = x; } while (0)
+#define LINK(x,y) do { x->l_next = y; x->l_prev = NULL; if (y) y->l_prev = x; } while (0)
#define INIT_LINK(x) do { x->l_next = NULL; x->l_prev = NULL; } while (0)
#define NEXT_LINK(x) ((x)->l_next)
diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c
index cac1f7f..2307493 100644
--- a/tools/widl/write_msft.c
+++ b/tools/widl/write_msft.c
@@ -1734,6 +1734,7 @@
chat("create_msft_typeinfo: name %s kind %d\n", name, kind);
msft_typeinfo = xmalloc(sizeof(*msft_typeinfo));
+ memset( msft_typeinfo, 0, sizeof(*msft_typeinfo) );
msft_typeinfo->typelib = typelib;