allocate string freed with free() later using malloc(), not new[] (fixes patch 772404)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2003-07-17 12:44:15 +00:00
parent 320656c465
commit f252f8c35d

View File

@@ -172,7 +172,9 @@ wxChar **ConvertToStandardCommandArgs(const wxChar *p, int& argc)
// and +1 here for the terminating NULL
wxChar **argv = new wxChar *[argc + 1];
argv[0] = new wxChar[MAX_PATH];
// as we use wxStrdup below we must allocate the first argument using
// malloc(), not new[], as well
argv[0] = (wxChar *)malloc(MAX_PATH * sizeof(wxChar));
::GetModuleFileName(wxhInstance, argv[0], MAX_PATH);
// copy all the other arguments to wxApp::argv[]