From f252f8c35dc04e75d9ee57d1eff4b98149be797a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 17 Jul 2003 12:44:15 +0000 Subject: [PATCH] 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 --- src/msw/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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[] -- 2.45.2