diff options
author | marha <marha@users.sourceforge.net> | 2011-01-31 13:24:04 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-01-31 13:24:04 +0000 |
commit | 6751d9898be671d253d6f7b0806cd4b10daaaf85 (patch) | |
tree | 23d7de97c118844b449b6c2102bc01b1385db39b /libwinmain/winmain.c | |
parent | 605c2377adb51f3fc7105ee92c4fb773b26d7f9b (diff) | |
download | vcxsrv-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/winmain.c')
-rw-r--r-- | libwinmain/winmain.c | 13 |
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; } |