Fixed memory leaks for STEPaggregate data.

* Data was created for use with STEPaggregate types in fedex_plus generated
  code but never destroyed.
* Fixed some code style alignment.
* STEPaggregate's STEPnodes never got destroyed.
This commit is contained in:
davyw
2012-04-05 20:40:09 +02:00
parent 4740f4d45c
commit 8a2665e980
3 changed files with 29 additions and 3 deletions
+9
View File
@@ -40,6 +40,14 @@ STEPaggregate::STEPaggregate() {
}
STEPaggregate::~STEPaggregate() {
STEPnode *node;
node = (STEPnode*) head;
while ( node ) {
head = node->NextNode();
delete node;
node = (STEPnode*) head;
}
}
STEPaggregate & STEPaggregate::ShallowCopy( const STEPaggregate & a ) {
@@ -829,6 +837,7 @@ SelectNode::SelectNode() {
}
SelectNode::~SelectNode() {
delete node;
}
SingleLinkNode * SelectNode::NewNode() {
+2 -2
View File
@@ -105,10 +105,10 @@ class SCL_CORE_EXPORT STEPattribute {
SDAI_Binary * b; // BINARY_TYPE
SDAI_Real * r; // REAL_TYPE and NUMBER_TYPE (Real is a double)
SDAI_Application_instance * * c; // ENTITY_TYPE
STEPaggregate * a; // AGGREGATE_TYPE
STEPaggregate * a; // AGGREGATE_TYPE
SDAI_Enum * e; // ENUM_TYPE, BOOLEAN_TYPE, and LOGICAL_TYPE
SDAI_Select * sh; // SELECT_TYPE
SCLundefined * u; // UNKNOWN_TYPE
SCLundefined * u; // UNKNOWN_TYPE
void * p;
} ptr;
+18 -1
View File
@@ -1661,7 +1661,24 @@ void LIBstructor_print( Entity entity, FILE * file, Schema schema ) {
to be deleted -- attributes will need reference count */
entnm = ENTITYget_classname( entity );
fprintf( file, "%s::~%s () { }\n", entnm, entnm );
fprintf( file, "%s::~%s () {\n", entnm, entnm );
attr_list = ENTITYget_attributes( entity );
LISTdo( attr_list, a, Variable )
if( VARget_initializer( a ) == EXPRESSION_NULL ) {
generate_attribute_name( a, attrnm );
t = VARget_type( a );
if( ( ! VARget_inverse( a ) ) && ( ! VARis_derived( a ) ) ) {
if( TYPEis_aggregate( t ) ) {
fprintf( file, " delete _%s;\n", attrnm );
}
}
}
LISTod;
fprintf( file, "}\n" );
}
/********************/