]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/init.cpp
fix recently introduced memory leak of m_conv (bug 1466559)
[wxWidgets.git] / src / common / init.cpp
index 9b87e1815244d7fbf73bbd262ffa881a144a862a..d126e10b8d465481cc8665e2ea2a83171ef0e38d 100644 (file)
@@ -179,7 +179,8 @@ static void ConvertArgsToUnicode(int argc, char **argv)
     gs_initData.argv = new wchar_t *[argc + 1];
     for ( int i = 0; i < argc; i++ )
     {
-        gs_initData.argv[i] = wxStrdup(wxConvLocal.cMB2WX(argv[i]));
+        wxWCharBuffer buf(wxConvLocal.cMB2WX(argv[i]));
+        gs_initData.argv[i] = buf ? wxStrdup(buf) : NULL;
     }
 
     gs_initData.argc = argc;
@@ -356,8 +357,6 @@ static void DoCommonPostCleanup()
 {
     wxModule::CleanUpModules();
 
-    wxClassInfo::CleanUp();
-
     // we can't do this in wxApp itself because it doesn't know if argv had
     // been allocated
 #if wxUSE_UNICODE
@@ -477,7 +476,7 @@ void wxUninitialize()
 {
     wxCRIT_SECT_LOCKER(lockInit, gs_initData.csInit);
 
-    if ( !--gs_initData.nInitCount )
+    if ( --gs_initData.nInitCount == 0 )
     {
         wxEntryCleanup();
     }