shell32: Use LocalFree in CommandLineToArgvW.

This commit is contained in:
Alexander Nicolaysen Sørnes 2008-01-29 22:04:25 +01:00 committed by Alexandre Julliard
parent 602e675375
commit 0f0678aa60
1 changed files with 5 additions and 5 deletions

View File

@ -97,20 +97,20 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
/* Return the path to the executable */ /* Return the path to the executable */
DWORD len, size=16; DWORD len, size=16;
hargv=GlobalAlloc(0, size); hargv=LocalAlloc(0, size);
argv=GlobalLock(hargv); argv=LocalLock(hargv);
for (;;) for (;;)
{ {
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR)); len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
if (!len) if (!len)
{ {
GlobalFree(hargv); LocalFree(hargv);
return NULL; return NULL;
} }
if (len < size) break; if (len < size) break;
size*=2; size*=2;
hargv=GlobalReAlloc(hargv, size, 0); hargv=LocalReAlloc(hargv, size, 0);
argv=GlobalLock(hargv); argv=LocalLock(hargv);
} }
argv[0]=(LPWSTR)(argv+1); argv[0]=(LPWSTR)(argv+1);
if (numargs) if (numargs)