diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2011-09-10 12:33:24 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2011-09-10 12:33:24 (GMT) |
| commit | 49a164b7ba69db5f8e50ee2576d0101a5304d860 (patch) | |
| tree | 7111e313a0bb0e1b2ebf8afeb069a8053a5d1d1e /src/main.c | |
| parent | 8084ae388effc43a833afef016440360013b9141 (diff) | |
| download | powder-49a164b7ba69db5f8e50ee2576d0101a5304d860.zip powder-49a164b7ba69db5f8e50ee2576d0101a5304d860.tar.gz | |
Fix various memory leaks, as noted by Merkil/cppcheck
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -637,7 +637,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0, unsigned char m = calloc(XRES*YRES, sizeof(int)); // make a catalog of free parts - memset(pmap, 0, sizeof(pmap)); + //memset(pmap, 0, sizeof(pmap)); "Using sizeof for array given as function argument returns the size of pointer." + memset(pmap, 0, sizeof(unsigned)*(XRES*YRES)); for (i=0; i<NPART; i++) if (parts[i].type) { @@ -3404,7 +3405,7 @@ int main(int argc, char *argv[]) if (sdl_mod&(KMOD_CAPS)) strappend(uitext, " [CAP LOCKS]"); if (GRID_MODE) - sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); + sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); //TODO: Undefined behavior: variable is used as parameter and destination in sprintf(). #ifdef INTERNAL if (vs) strappend(uitext, " [FRAME CAPTURE]"); |
