Commit 883aef17 authored by Alexandre Julliard's avatar Alexandre Julliard

widl: xmalloc shouldn't initialize to zero, do that explicitly where needed.

parent 80a9a065
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......@@ -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)
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment