Salome HOME
Suppress memory leak when using Kernel_Utils::decode()
[modules/smesh.git] / src / SMESH / SMESH_Gen.cxx
index 399cef5292790aacec51ed47b3b44f6c63d80bd7..65e59d98dfdb38e53223261b42b0937910621293 100644 (file)
@@ -1077,18 +1077,14 @@ std::vector< std::string > SMESH_Gen::GetPluginXMLPaths()
       xmlPath += sep + plugin + ".xml";
       bool fileOK;
 #ifdef WIN32
-  #ifdef UNICODE
+#  ifdef UNICODE
       const wchar_t* path = Kernel_Utils::decode_s(xmlPath);
-  #else
+      SMESHUtils::ArrayDeleter<const wchar_t> deleter( path );
+#  else
       const char* path = xmlPath.c_str();
-  #endif
-
+#  endif
       fileOK = (GetFileAttributes(path) != INVALID_FILE_ATTRIBUTES);
 
-  #ifdef UNICODE
-      delete path;
-  #endif
-
 #else
       fileOK = (access(xmlPath.c_str(), F_OK) == 0);
 #endif