From ec91014320828afc1e3f5ab7b55f34e4dd48adb0 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Thu, 20 Mar 2014 14:53:20 +0100 Subject: [PATCH] Fix memory bugs (double free) in SALOMEDS_AttributeTableOfXXX classes --- src/SALOMEDS/SALOMEDS_AttributeTableOfInteger.cxx | 2 +- src/SALOMEDS/SALOMEDS_AttributeTableOfReal.cxx | 6 +++--- src/SALOMEDS/SALOMEDS_AttributeTableOfString.cxx | 14 +++++++------- 3 files changed, 11 insertions(+), 11 deletions(-) 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); } } -- 2.39.2