From: Renaud Barate Date: Thu, 20 Mar 2014 13:53:20 +0000 (+0100) Subject: Fix memory bugs (double free) in SALOMEDS_AttributeTableOfXXX classes X-Git-Tag: V7_4_0a1~3^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ec91014320828afc1e3f5ab7b55f34e4dd48adb0;p=modules%2Fkernel.git Fix memory bugs (double free) in SALOMEDS_AttributeTableOfXXX classes --- diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx index 90d57835a..838d2c8bb 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx @@ -226,7 +226,7 @@ void SALOMEDS_AttributeTableOfInteger::SetRowUnits(const std::vectorlength(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); } } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx index 34af17fb2..647d34be5 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx @@ -101,7 +101,7 @@ void SALOMEDS_AttributeTableOfReal::SetRowTitles(const std::vector& 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::vectorlength(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& 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); } } diff --git a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx index 79637243c..817f69715 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx @@ -103,7 +103,7 @@ void SALOMEDS_AttributeTableOfString::SetRowTitles(const std::vectorlength(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::vectorlength(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 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& 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::vectorlength(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& 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); } }