aboutsummaryrefslogtreecommitdiff
path: root/libwinmain
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-31 13:24:04 +0000
committermarha <marha@users.sourceforge.net>2011-01-31 13:24:04 +0000
commit6751d9898be671d253d6f7b0806cd4b10daaaf85 (patch)
tree23d7de97c118844b449b6c2102bc01b1385db39b /libwinmain
parent605c2377adb51f3fc7105ee92c4fb773b26d7f9b (diff)
downloadvcxsrv-6751d9898be671d253d6f7b0806cd4b10daaaf85.tar.gz
vcxsrv-6751d9898be671d253d6f7b0806cd4b10daaaf85.tar.bz2
vcxsrv-6751d9898be671d253d6f7b0806cd4b10daaaf85.zip
Enabled global optimisation in release build
winmain : GetEnvironmentStrings return should be freed with FreeEnvironmentStrings
Diffstat (limited to 'libwinmain')
-rw-r--r--libwinmain/winmain.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libwinmain/winmain.c b/libwinmain/winmain.c
index 126c19da4..4e5886397 100644
--- a/libwinmain/winmain.c
+++ b/libwinmain/winmain.c
@@ -74,6 +74,7 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
char *pProgramName;
char **penv;
int Ret;
+ LPTCH pEnvStrings;
hInstance=hInstance;
nCmdShow=nCmdShow;
@@ -132,20 +133,22 @@ int __stdcall WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdL
}
{
- LPTCH pEnvStrings=GetEnvironmentStrings();
+ LPTCH pTmp=GetEnvironmentStrings();
int NrEnv=0;
+ pEnvStrings=pTmp;
penv=malloc(sizeof(*penv));
- while (*pEnvStrings)
+ while (*pTmp)
{
penv=realloc(penv,(NrEnv+2)*sizeof(*penv));
- penv[NrEnv++]=pEnvStrings;
- while (*pEnvStrings) pEnvStrings++;
- pEnvStrings++;
+ penv[NrEnv++]=pTmp;
+ while (*pTmp) pTmp++;
+ pTmp++;
}
penv[NrEnv]=NULL;
}
Ret = main(argc,argv,penv);
free(penv);
+ FreeEnvironmentStrings(pEnvStrings);
return Ret;
}