From: Vadim Zeitlin Date: Thu, 17 Jul 2003 12:44:15 +0000 (+0000) Subject: allocate string freed with free() later using malloc(), not new[] (fixes patch 772404) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f252f8c35dc04e75d9ee57d1eff4b98149be797a 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 --- diff --git a/src/msw/main.cpp b/src/msw/main.cpp index 5617b1f15c..f761ec971a 100644 --- a/src/msw/main.cpp +++ b/src/msw/main.cpp @@ -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[]