@@ -851,6 +851,8 @@ SDAI_Application_instance * STEPfile::CreateInstance( istream & in, ostream & ou
851851 << " User Defined Entity in DATA section ignored.\n "
852852 << " \t Data lost: \' !" << objnm << " \' : " << tmpbuf
853853 << endl;
854+ if (scopelist)
855+ delete[] scopelist;
854856 return ENTITY_NULL;
855857 } else {
856858 schnm = schemaName ();
@@ -879,6 +881,8 @@ SDAI_Application_instance * STEPfile::CreateInstance( istream & in, ostream & ou
879881 out << " ERROR: instance #" << fileid << " \' " << objnm
880882 << " \' : " << result.UserMsg ()
881883 << " .\n\t Data lost: " << tmpbuf << " \n\n " ;
884+ if (scopelist)
885+ delete[] scopelist;
882886 return ENTITY_NULL;
883887 }
884888 obj -> STEPfile_id = fileid;
@@ -887,6 +891,10 @@ SDAI_Application_instance * STEPfile::CreateInstance( istream & in, ostream & ou
887891 SkipInstance ( in, tmpbuf );
888892
889893 ReadTokenSeparator ( in );
894+
895+ if (scopelist)
896+ delete[] scopelist;
897+
890898 return obj;
891899}
892900
@@ -1531,9 +1539,11 @@ void STEPfile::WriteHeaderInstance( SDAI_Application_instance * obj, ostream & o
15311539void STEPfile::WriteHeaderInstanceFileName ( ostream & out ) {
15321540// Get the FileName instance from _headerInstances
15331541 SDAI_Application_instance * se = 0 ;
1542+ bool del_se = false ;
15341543 se = _headerInstances->GetApplication_instance ( " File_Name" );
15351544 if ( se == ENTITY_NULL ) {
15361545 se = ( SDAI_Application_instance * )HeaderDefaultFileName ();
1546+ del_se = true ;
15371547 }
15381548
15391549// set some of the attribute values at time of output
@@ -1553,6 +1563,9 @@ void STEPfile::WriteHeaderInstanceFileName( ostream & out ) {
15531563
15541564// output the values to the file
15551565 WriteHeaderInstance ( se, out );
1566+
1567+ if (del_se)
1568+ delete se;
15561569}
15571570
15581571void STEPfile::WriteHeaderInstanceFileDescription ( ostream & out ) {
@@ -1563,8 +1576,11 @@ void STEPfile::WriteHeaderInstanceFileDescription( ostream & out ) {
15631576 // ERROR: no File_Name instance in _headerInstances
15641577 // create a File_Name instance
15651578 se = ( SDAI_Application_instance * )HeaderDefaultFileDescription ();
1579+ WriteHeaderInstance (se, out);
1580+ delete se;
1581+ } else {
1582+ WriteHeaderInstance ( se, out );
15661583 }
1567- WriteHeaderInstance ( se, out );
15681584}
15691585
15701586void STEPfile::WriteHeaderInstanceFileSchema ( ostream & out ) {
@@ -1575,8 +1591,11 @@ void STEPfile::WriteHeaderInstanceFileSchema( ostream & out ) {
15751591 // ERROR: no File_Name instance in _headerInstances
15761592 // create a File_Name instance
15771593 se = ( SDAI_Application_instance * ) HeaderDefaultFileSchema ();
1594+ WriteHeaderInstance ( se, out );
1595+ delete se;
1596+ } else {
1597+ WriteHeaderInstance ( se, out );
15781598 }
1579- WriteHeaderInstance ( se, out );
15801599}
15811600
15821601void STEPfile::WriteData ( ostream & out, int writeComments ) {
0 commit comments