Silence valgrind uninitialized bytes complaints
Just zero out the allocated memory. Explicitly setting struct field values isn't enough, because field alignment means there can be several unused bytes which are written to savefile.
This commit is contained in:
@@ -458,6 +458,8 @@ alloc_doors(void)
|
||||
if (!gd.doors || gd.doorindex >= gd.doors_alloc) {
|
||||
int c = gd.doors_alloc + DOORINC;
|
||||
coord *doortmp = (coord *) alloc(c * sizeof(coord));
|
||||
|
||||
(void) memset((genericptr_t) doortmp, 0, c * sizeof(coord));
|
||||
if (gd.doors) {
|
||||
(void) memcpy(doortmp, gd.doors, gd.doors_alloc * sizeof(coord));
|
||||
free(gd.doors);
|
||||
|
||||
Reference in New Issue
Block a user