diff --git a/Code/IO/otbVectorDataKeywordlist.cxx b/Code/IO/otbVectorDataKeywordlist.cxx index 2e41cc11fde47ab386c16bb7aabdb69efcc866b1..8e276f148b8b9c9b0c22a9351587adfb358242e9 100644 --- a/Code/IO/otbVectorDataKeywordlist.cxx +++ b/Code/IO/otbVectorDataKeywordlist.cxx @@ -34,6 +34,10 @@ VectorDataKeywordlist { for (unsigned int i = 0; i < m_FieldList.size(); ++i) { + if (m_FieldList[i].first->GetType() == OFTString) + { + CPLFree( m_FieldList[i].second.String ); + } delete(m_FieldList[i].first); } } @@ -46,7 +50,8 @@ void VectorDataKeywordlist:: newField.second = *field; //TODO: evaluate performance impact of fieldDefn copy // the object itself could be handle at the VectorData level - // keeping only pointer here. + // keeping only pointer here. (but it does not seem + // necessary so far...) m_FieldList.push_back(CopyOgrField(newField)); }; diff --git a/Code/IO/otbVectorDataKeywordlist.h b/Code/IO/otbVectorDataKeywordlist.h index ebba3e089b62fea0b8b5f6db161c773a1d292319..606ee31b6c2284c4c85161be509082b5fbe89dc3 100644 --- a/Code/IO/otbVectorDataKeywordlist.h +++ b/Code/IO/otbVectorDataKeywordlist.h @@ -44,15 +44,6 @@ class VectorDataKeywordlist public: /** Smart pointer typedef support. */ typedef VectorDataKeywordlist Self; -// typedef itk::LightObject Superclass; -// typedef itk::SmartPointer<Self> Pointer; -// typedef itk::SmartPointer<const Self> ConstPointer; -// -// /** Method for creation through the object factory. */ -// itkNewMacro(Self); -// -// /** Run-time type information (and related methods). */ -// itkTypeMacro(VectorDataKeywordlist, LightObject); typedef std::pair<OGRFieldDefn*,OGRField> FieldType; typedef std::vector< FieldType > FieldListType; @@ -65,7 +56,10 @@ class VectorDataKeywordlist VectorDataKeywordlist(); virtual ~VectorDataKeywordlist(); + /** Constructor by copy (deep copy)*/ VectorDataKeywordlist(const Self&); + + /** Deep copy operator*/ void operator=(const Self&); protected: