Free array we get from CommandLineToArgvW

This commit is contained in:
Tamás Bálint Misius 2022-04-08 07:14:39 +02:00
parent 18c604fd42
commit f6878dcdb6
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -532,17 +532,15 @@ int main(int argc, char *argv[]);
int WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
int argc;
wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
std::vector<ByteString> argv;
std::vector<char *> argp;
wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
for (auto i = 0; i < argc; ++i)
{
argv.push_back(Platform::WinNarrow(std::wstring(wargv[i])));
argp.push_back(&argv.back()[0]);
}
std::vector<char *> argp;
for (auto &arg : argv)
{
argp.push_back(&arg[0]);
}
LocalFree(wargv);
return main(argc, &argp[0]);
}
#endif