From: ageay Date: Thu, 9 Jan 2014 14:54:48 +0000 (+0000) Subject: Bug of memory corruption. X-Git-Tag: V7_3_1b1^2~36 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=9950b7a4dd737ed13c51a3ac02e16f80d4dd3e37;p=modules%2Fmed.git Bug of memory corruption. --- diff --git a/src/MEDOP/cmp/MEDDataManager_i.cxx b/src/MEDOP/cmp/MEDDataManager_i.cxx index d76c4e8f8..2e1e492a5 100644 --- a/src/MEDOP/cmp/MEDDataManager_i.cxx +++ b/src/MEDOP/cmp/MEDDataManager_i.cxx @@ -583,14 +583,13 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand long sourceid = _meshHandlerMap[meshid]->sourceid; const char * filepath = source_to_file((_datasourceHandlerMap[sourceid])->uri); - std::string smeshname = myMesh->getName(); - const char * meshName = smeshname.c_str(); + std::string meshName(myMesh->getName()); LOG("getFieldDouble: field "<fieldname<<" loaded from file "<type; int meshDimRelToMax = 0; MEDCouplingFieldDouble * myField = MEDLoader::ReadField(type, filepath, - meshName, + meshName.c_str(), meshDimRelToMax, fieldHandler->fieldname, fieldHandler->iteration, @@ -613,8 +612,8 @@ MEDCouplingFieldDouble * MEDDataManager_i::getFieldDouble(const MEDOP::FieldHand MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldDouble, long meshHandlerId) { - const char * fieldName = fieldDouble->getName().c_str(); - const char * meshName = fieldDouble->getMesh()->getName().c_str(); + std::string fieldName(fieldDouble->getName()); + std::string meshName(fieldDouble->getMesh()->getName()); TypeOfField type = fieldDouble->getTypeOfField(); int iteration, order; @@ -630,12 +629,12 @@ MEDOP::FieldHandler * MEDDataManager_i::addField(MEDCouplingFieldDouble * fieldD // the fielddouble name, because this name describes the operation // the field has been created with. string * source = new string("mem://"); source->append(fieldName); - MEDOP::FieldHandler * fieldHandler = newFieldHandler(fieldName, - meshName, - type, - iteration, - order, - source->c_str()); + MEDOP::FieldHandler * fieldHandler = newFieldHandler(fieldName.c_str(), + meshName.c_str(), + type, + iteration, + order, + source->c_str()); if ( meshHandlerId == LONG_UNDEFINED ) { // We have to gess the id of the underlying mesh to preserve data