Salome HOME
Fix memory bugs (double free) in SALOMEDS_AttributeTableOfXXX classes
authorRenaud Barate <renaud.barate@edf.fr>
Thu, 20 Mar 2014 13:53:20 +0000 (14:53 +0100)
committerRenaud Barate <renaud.barate@edf.fr>
Thu, 20 Mar 2014 13:53:20 +0000 (14:53 +0100)
src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx
src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx

index 90d57835a6c49b4c3d46857f4216209a7a017365..838d2c8bb406fbee10913459bc77a380bf8ad055 100644 (file)
@@ -226,7 +226,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vector<std::string
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theUnits[i].c_str();
     SALOMEDS::AttributeTableOfInteger::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
index 34af17fb26da77f8a449dd50183982df37095e74..647d34be5e63a7869d7bc5a923037f0a60e89fc9 100644 (file)
@@ -101,7 +101,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector<std::string>&
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowTitles(aSeq);
   }
 }
@@ -161,7 +161,7 @@ void SALOMEDS_AttributeTableOfReal::SetColumnTitles(const std::vector<std::strin
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetColumnTitles(aSeq);
   }
 }
@@ -221,7 +221,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowUnits(const std::vector<std::string>&
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theUnits[i].c_str();
     SALOMEDS::AttributeTableOfReal::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
index 79637243cbb0914e990b8ef042f78301bb5afb92..817f6971522cb358b800f48a2bd58b1f81b5b568 100644 (file)
@@ -103,7 +103,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vector<std::string
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowTitles(aSeq);
   }
 }
@@ -163,7 +163,7 @@ void SALOMEDS_AttributeTableOfString::SetColumnTitles(const std::vector<std::str
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theTitles[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theTitles[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumnTitles(aSeq);
   }
 }
@@ -223,7 +223,7 @@ void SALOMEDS_AttributeTableOfString::SetRowUnits(const std::vector<std::string>
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theUnits[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theUnits[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRowUnits(aSeq);
   }
 }
@@ -283,7 +283,7 @@ void SALOMEDS_AttributeTableOfString::AddRow(const std::vector<std::string>& the
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddRow(aSeq);
   }
 }
@@ -305,7 +305,7 @@ void SALOMEDS_AttributeTableOfString::SetRow(int theRow, const std::vector<std::
   else {
     SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq();
     aSeq->length(aLength);
-    for (i = 0; i < aLength; i++) aSeq[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aSeq[i] = theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetRow(theRow, aSeq);
   }
 }
@@ -344,7 +344,7 @@ void SALOMEDS_AttributeTableOfString::AddColumn(const std::vector<std::string>&
   else {
     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
     aColumn->length(aLength);
-    for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->AddColumn(aColumn);
   }
 }
@@ -366,7 +366,7 @@ void SALOMEDS_AttributeTableOfString::SetColumn(int theColumn, const std::vector
   else {
     SALOMEDS::StringSeq_var aColumn = new SALOMEDS::StringSeq();
     aColumn->length(aLength);
-    for (i = 0; i < aLength; i++) aColumn[i] = (char*)theData[i].c_str();
+    for (i = 0; i < aLength; i++) aColumn[i] = theData[i].c_str();
     SALOMEDS::AttributeTableOfString::_narrow(_corba_impl)->SetColumn(theColumn, aColumn);
   }
 }