Fixed some memory leaks in ExpDict.cc.

* TypeDescriptor::_where_rules never got destroyed.
* Where_rule__list, Uniqueness_rule__set and Global_rule__set never
  destroyed their content.
* Inverse_attributeList never destroyed it's content.
This commit is contained in:
davyw
2012-04-05 20:40:11 +02:00
parent 626bb73cb9
commit a1d6b25e75
2 changed files with 30 additions and 0 deletions
+14
View File
@@ -1025,6 +1025,8 @@ Where_rule__list::Where_rule__list( int defaultSize ) {
}
Where_rule__list::~Where_rule__list() {
Clear();
delete _buf;
}
@@ -1102,6 +1104,9 @@ int Where_rule__list::Count() {
}
void Where_rule__list::Clear() {
for ( int i = 0; i < _count ; i ++ ) {
delete _buf[i];
}
_count = 0;
}
@@ -1130,6 +1135,8 @@ Uniqueness_rule__set::Uniqueness_rule__set( int defaultSize ) {
}
Uniqueness_rule__set::~Uniqueness_rule__set() {
Clear();
delete _buf;
}
@@ -1207,6 +1214,9 @@ int Uniqueness_rule__set::Count() {
}
void Uniqueness_rule__set::Clear() {
for ( int i = 0; i < _count; i ++ ) {
delete _buf[i];
}
_count = 0;
}
@@ -1247,6 +1257,7 @@ Global_rule__set::Global_rule__set( int defaultSize ) {
}
Global_rule__set::~Global_rule__set() {
Clear();
delete _buf;
}
@@ -1324,6 +1335,9 @@ int Global_rule__set::Count() {
}
void Global_rule__set::Clear() {
for ( int i = 0; i < _count; i ++ ) {
delete _buf[i];
}
_count = 0;
}
+16
View File
@@ -123,6 +123,9 @@ AttrDescLinkNode::AttrDescLinkNode() {
}
AttrDescLinkNode::~AttrDescLinkNode() {
if ( _attrDesc ) {
delete _attrDesc;
}
}
AttrDescItr::AttrDescItr( const AttrDescriptorList & adList ) : adl( adList ) {
@@ -143,6 +146,13 @@ Inverse_attributeList::Inverse_attributeList() {
}
Inverse_attributeList::~Inverse_attributeList() {
Inverse_attributeLinkNode *node;
node = ( Inverse_attributeLinkNode* ) head;
while ( node ) {
delete node->Inverse_attr();
node = ( Inverse_attributeLinkNode* ) node->NextNode();
}
}
Inverse_attributeLinkNode * Inverse_attributeList::AddNode( Inverse_attribute * ad ) {
@@ -211,6 +221,12 @@ TypeDescriptor::TypeDescriptor
_where_rules( 0 ) {
}
TypeDescriptor::~TypeDescriptor() {
if ( _where_rules ) {
delete _where_rules;
}
}
/**
* Determines the current name of this. Normally, this is simply _name.
* If "schnm" is set to a value, however, then this function becomes a