Salome HOME
Memory leak hunting
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Aug 2021 08:07:11 +0000 (10:07 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 17 Aug 2021 08:07:11 +0000 (10:07 +0200)
src/SMESH_I/SMESH_Gen_i.cxx
src/SMESH_I/SMESH_Gen_i_1.cxx
src/SMESH_I/SMESH_PreMeshInfo.cxx

index 677e7fb99cb5f9eb720c97fa0d99eb5c4ef24c2c..30d0352628819ea10452f6257cbef4ee2c3d539b 100644 (file)
@@ -5917,7 +5917,8 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
               if ( aNewGroup->_is_nil() )
                 continue;
 
               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 );
 
               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 )) {
 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;
 }
   }
   return 0;
 }
index d31ccf2d8db6ecaf681d5edde0db8696f35de486..3f463f1f5db14e3db37ee9c46ff2f3e33dace6aa 100644 (file)
@@ -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
   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;
   // Find study component which corresponds to this SMESH engine
 
   SALOMEDS::SComponent_wrap father;
index 838a77ebeb9cf736878cc99202dc1af9e40732b1..c7a22bf1b3fc61dc0c42f5349e8931346b056be1 100644 (file)
@@ -272,6 +272,7 @@ namespace
       dataset->WriteOnDisk( & data[0]  );
       dataset->CloseOnDisk();
       anArray->CloseOnDisk();
       dataset->WriteOnDisk( & data[0]  );
       dataset->CloseOnDisk();
       anArray->CloseOnDisk();
+      delete anArray;
     }
   }
 }
     }
   }
 }