summaryrefslogtreecommitdiff
path: root/src/misc.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/misc.c
parent8084ae388effc43a833afef016440360013b9141 (diff)
downloadpowder-49a164b7ba69db5f8e50ee2576d0101a5304d860.zip
powder-49a164b7ba69db5f8e50ee2576d0101a5304d860.tar.gz
Fix various memory leaks, as noted by Merkil/cppcheck
Diffstat (limited to 'src/misc.c')
-rw-r--r--src/misc.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/misc.c b/src/misc.c
index 4fc616b..8983f1f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -470,8 +470,8 @@ int register_extension()
LONG rresult;
HKEY newkey;
char *currentfilename = exe_name();
- char *iconname;
- char *opencommand;
+ char *iconname = NULL;
+ char *opencommand = NULL;
iconname = malloc(strlen(currentfilename)+6);
opencommand = malloc(strlen(currentfilename)+13);
sprintf(iconname, "%s,-102", currentfilename);
@@ -536,6 +536,10 @@ int register_extension()
}
RegCloseKey(newkey);
+ if(iconname) free(iconname);
+ if(opencommand) free(opencommand);
+ if(currentfilename) free(currentfilename);
+
return 1;
#elif defined(LIN32) || defined(LIN64)
char *currentfilename = exe_name();