summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorSimon 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)
commit49a164b7ba69db5f8e50ee2576d0101a5304d860 (patch)
tree7111e313a0bb0e1b2ebf8afeb069a8053a5d1d1e /src/main.c
parent8084ae388effc43a833afef016440360013b9141 (diff)
downloadpowder-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.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 8fc0a72..c9761dd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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]");