I'm weeding out Purify bugs slowly but surely, but ran into two I'm not
sure what to do about:
#1 ----------------------
Copying 32 bytes from 0x02b469c8 (16 bytes at 0x02b469d8
uninitialized)
Address 0x02b469c8 is at the beginning of a 32 byte block
Address 0x02b469c8 points to a malloc'd block in heap 0x02b40000
Thread ID: 0x450
Error location
resourceLoader [resource.c:291]
if (base.resource)
while (seeker) {
memcpy(resource_map + resourceCounter, seeker->resource,
=> sizeof(resource_t));
resourceCounter++;
seeker = seeker->next;
}
-----------------------------
#2 ---------------------------------
I fixed this by initializing conf after the malloc. The original warning
was:
[W] UMC: Uninitialized memory copy in memcpy {1 occurrence}
Copying 208 bytes from 0x02b623b8 (4 bytes at 0x02b623ec
uninitialized)
Address 0x02b623b8 is at the beginning of a 416 byte block
Address 0x02b623b8 points to a malloc'd block in heap 0x02b60000
Thread ID: 0x45c
Error location
memcpy [memcpy.obj]
UnnamedFunction [config.l:270]
conf = sci_realloc(conf, sizeof(config_entry_t) * (cur_section +
1));
/* ...and initialize it */
=> memcpy(&(conf[cur_section]), &(conf[0]), sizeof(config_entry_t));
After memset'ing conf to 0, I then get:
[E] NPR: NULL pointer read in stricmp {1 occurrence}
read_config [main.c:544]
=> if (!strcasecmp((*conf)[i].name, game_name)) {
Any ideas on the appropriate fixes for these?
--
http://www.clock.org/~matt