diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 2c1e029d3cd..ead02cbbc79 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1144,6 +1144,7 @@ static type_t *make_type(unsigned char type, type_t *ref) 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 @@ static var_t *make_var(char *name) 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 7a1b246d8ce..52180705858 100644 --- a/tools/widl/typelib.c +++ b/tools/widl/typelib.c @@ -220,6 +220,8 @@ void start_typelib(char *name, attr_t *attrs) 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 @@ static void read_msft_importlib(importlib_t *importlib, int fd) 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 @@ void add_importlib(const char *name) 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 9f82184cd94..fea0540bc61 100644 --- a/tools/widl/utils.c +++ b/tools/widl/utils.c @@ -145,7 +145,7 @@ char *dup_basename(const char *name, const char *ext) 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 @@ void *xmalloc(size_t size) { 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 *xstrdup(const char *str) 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 cf0f2462a34..eeaa627200f 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -49,7 +49,7 @@ typedef struct _typelib_t typelib_t; 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 cac1f7f9f2d..23074936c8b 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -1734,6 +1734,7 @@ static msft_typeinfo_t *create_msft_typeinfo(msft_typelib_t *typelib, enum type_ 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;