From: Anthony Geay Date: Tue, 17 Aug 2021 08:07:11 +0000 (+0200) Subject: Memory leak hunting X-Git-Tag: V9_8_0a1~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=465e5be442f0;p=modules%2Fsmesh.git Memory leak hunting --- diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index 677e7fb99..30d035262 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -5917,7 +5917,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent, if ( aNewGroup->_is_nil() ) continue; - string iorSubString = GetORB()->object_to_string( aNewGroup ); + CORBA::String_var iorSubStringVar = GetORB()->object_to_string( aNewGroup ); + string iorSubString(iorSubStringVar.in()); int newSubId = myStudyContext->findId( iorSubString ); myStudyContext->mapOldToNew( subid, newSubId ); @@ -6240,8 +6241,9 @@ int SMESH_Gen_i::RegisterObject(CORBA::Object_ptr theObject) CORBA::Long SMESH_Gen_i::GetObjectId(CORBA::Object_ptr theObject) { if ( myStudyContext && !CORBA::is_nil( theObject )) { - string iorString = GetORB()->object_to_string( theObject ); - return myStudyContext->findId( iorString ); + CORBA::String_var iorString = GetORB()->object_to_string( theObject ); + string iorStringCpp(iorString.in()); + return myStudyContext->findId( iorStringCpp ); } return 0; } diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index d31ccf2d8..3f463f1f5 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -548,8 +548,11 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent() SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder(); std::string compDataType = ComponentDataType(); // SMESH module's data type - std::string ior = SMESH_Gen_i::GetORB()->object_to_string( SMESH_Gen::_this() ); // IOR of this SMESH engine - + std::string ior; + { + CORBA::String_var iorString = GetORB()->object_to_string( SMESH_Gen::_this() ); + ior = std::string( iorString.in() ); // IOR of this SMESH engine + } // Find study component which corresponds to this SMESH engine SALOMEDS::SComponent_wrap father; diff --git a/src/SMESH_I/SMESH_PreMeshInfo.cxx b/src/SMESH_I/SMESH_PreMeshInfo.cxx index 838a77ebe..c7a22bf1b 100644 --- a/src/SMESH_I/SMESH_PreMeshInfo.cxx +++ b/src/SMESH_I/SMESH_PreMeshInfo.cxx @@ -272,6 +272,7 @@ namespace dataset->WriteOnDisk( & data[0] ); dataset->CloseOnDisk(); anArray->CloseOnDisk(); + delete anArray; } } }