Commit fba0897e authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent 1916cb1e
......@@ -51,6 +51,7 @@ res_t *new_res(void)
r = (res_t *)xmalloc(sizeof(res_t));
r->allocsize = RES_BLOCKSIZE;
r->size = 0;
r->dataidx = 0;
r->data = (char *)xmalloc(RES_BLOCKSIZE);
return r;
}
......
......@@ -76,6 +76,7 @@ __NEW_STRUCT_FUNC(ani_any)
resource_t *new_resource(enum res_e t, void *res, int memopt, language_t *lan)
{
resource_t *r = (resource_t *)xmalloc(sizeof(resource_t));
memset( r, 0, sizeof(*r) );
r->type = t;
r->res.overlay = res;
r->memopt = memopt;
......@@ -1145,6 +1146,7 @@ stringtable_t *new_stringtable(lvc_t *lvc)
{
stringtable_t *stt = (stringtable_t *)xmalloc(sizeof(stringtable_t));
memset( stt, 0, sizeof(*stt) );
if(lvc)
stt->lvc = *lvc;
......@@ -1154,6 +1156,7 @@ stringtable_t *new_stringtable(lvc_t *lvc)
toolbar_t *new_toolbar(int button_width, int button_height, toolbar_item_t *items, int nitems)
{
toolbar_t *tb = (toolbar_t *)xmalloc(sizeof(toolbar_t));
memset( tb, 0, sizeof(*tb) );
tb->button_width = button_width;
tb->button_height = button_height;
tb->nitems = nitems;
......
......@@ -26,7 +26,9 @@
#define __NEW_STRUCT_FUNC(p) \
p##_t *new_##p(void)\
{\
return (p##_t *)xmalloc(sizeof(p##_t));\
p##_t * ret = xmalloc(sizeof(*ret)); \
memset( ret, 0, sizeof(*ret) ); \
return ret; \
}
#define __NEW_STRUCT_PROTO(p) p##_t *new_##p(void)
......
......@@ -2286,6 +2286,7 @@ static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev
static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid)
{
itemex_opt_t *opt = (itemex_opt_t *)xmalloc(sizeof(itemex_opt_t));
memset( opt, 0, sizeof(*opt) );
opt->id = id;
opt->type = type;
opt->state = state;
......@@ -2602,6 +2603,7 @@ static resource_t *build_stt_resources(stringtable_t *stthead)
{
newstt = new_stringtable(&stt->lvc);
newstt->entries = (stt_entry_t *)xmalloc(16 * sizeof(stt_entry_t));
memset( newstt->entries, 0, 16 * sizeof(stt_entry_t) );
newstt->nentries = 16;
newstt->idbase = stt->entries[i].id & ~0xf;
for(j = 0; j < 16 && i < stt->nentries; j++)
......@@ -2823,6 +2825,7 @@ static resource_t *build_fontdirs(resource_t *tail)
/* Copy space */
lanfnt = xmalloc(nfnt * sizeof(*lanfnt));
memset( lanfnt, 0, nfnt * sizeof(*lanfnt));
/* Get all fonts covered by fontdirs */
for(i = 0; i < nfnd; i++)
......
......@@ -168,12 +168,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;
}
......
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