Fixed some memory leaks reported by scl_memmgr.

This commit is contained in:
davyw committed 2012-03-13 21:19:47 +01:00
1 parent f5d0cc59aa
commit 3010afa7ea
3 files changed
+16 -8

No files matched your search

+10 -7
View File
@@ -121,6 +121,7 @@ void format_for_std_stringout( FILE * f, const char * orig_buf ) {
optr++;
}
fprintf( f, s_end );
scl_free( orig_buf );
}
void USEREFout( Schema schema, Dictionary refdict, Linked_List reflist, char * type, FILE * file ) {
@@ -2015,11 +2016,9 @@ void ENTITYincode_print( Entity entity, FILE * file, Schema schema ) {
fprintf( file, " str.clear();\n str.append( \"ABSTRACT SUPERTYPE OF ( \" );\n" );
tmp = SUBTYPEto_string( entity->u.entity->subtype_expression );
format_for_std_stringout( file, tmp );
format_for_std_stringout( file, SUBTYPEto_string( entity->u.entity->subtype_expression ) );
fprintf( file, "\n str.append( \")\" );\n" );
fprintf( file, " %s::%s%s->AddSupertype_Stmt( str );", schema_name, ENT_PREFIX, entity_name );
scl_free( tmp );
} else {
fprintf( file, " %s::%s%s->AddSupertype_Stmt( \"ABSTRACT SUPERTYPE\" );\n",
schema_name, ENT_PREFIX, entity_name );
@@ -2027,10 +2026,8 @@ void ENTITYincode_print( Entity entity, FILE * file, Schema schema ) {
} else {
if( entity->u.entity->subtype_expression ) {
fprintf( file, " str.clear();\n str.append( \"SUPERTYPE OF ( \" );\n" );
tmp = SUBTYPEto_string( entity->u.entity->subtype_expression );
format_for_std_stringout( file, tmp );
format_for_std_stringout( file, SUBTYPEto_string( entity->u.entity->subtype_expression ) );
fprintf( file, "\n str.append( \")\" );\n" );
scl_free( tmp );
fprintf( file, " %s::%s%s->AddSupertype_Stmt( str );", schema_name, ENT_PREFIX, entity_name );
}
}
@@ -2524,6 +2521,7 @@ void ENTITYprint_new( Entity entity, FILES * files, Schema schema, int externMap
}
uniqRule = EXPRto_string( v->name );
fprintf( files->create, "%s", uniqRule );
scl_free( uniqRule );
}
LISTod
fprintf( files->create, ";\\n\");\n" );
@@ -2532,6 +2530,8 @@ void ENTITYprint_new( Entity entity, FILES * files, Schema schema, int externMap
LISTod
/********/
if ( whereRule_formatted_size == 0 )
scl_free( uniqRule_formatted );
}
if( whereRule_formatted_size > 0 ) {
@@ -3363,10 +3363,13 @@ void TYPEprint_new( const Type type, FILE * create, Schema schema ) {
/* in source - the real definition of the TypeDescriptor */
if( TYPEis_select( type ) ) {
char * temp;
temp = non_unique_types_string( type );
fprintf( create,
" %s = new SelectTypeDescriptor (\n ~%s, //unique elements,\n",
TYPEtd_name( type ),
non_unique_types_string( type ) );
temp );
scl_free( temp );
/* DAS ORIG SCHEMA FIX */
TYPEprint_nm_ft_desc( schema, type, create, "," );
+4 -1
View File
@@ -461,12 +461,15 @@ void SCHEMAprint( Schema schema, FILES * files, Express model, void * complexCol
/* add global RULEs to Schema dictionary entry */
DICTdo_type_init( schema->symbol_table, &de, OBJ_RULE );
while( 0 != ( r = ( Rule )DICTdo( &de ) ) ) {
char *tmp;
fprintf( createall, " str.clear();\n" );
format_for_std_stringout( createall, RULEto_string( r ) );
fprintf( createall, " gr = new Global_rule(\"%s\",%s::schema, str );\n",
r->symbol.name, SCHEMAget_name( schema ) );
fprintf( createall, " %s::schema->AddGlobal_rule(gr);\n", SCHEMAget_name( schema ) );
fprintf( createall, "/*\n%s\n*/\n", RULEto_string( r ) );
tmp = RULEto_string( r );
fprintf( createall, "/*\n%s\n*/\n", tmp );
scl_free( tmp );
}
/**************/
/* add FUNCTIONs to Schema dictionary entry */
+2
View File
@@ -2033,6 +2033,8 @@ TYPEselect_print( Type t, FILES * files, Schema schema ) {
/* TYPEselect_init_print (t, files -> init, schema);
DAR - moved to TYPEprint_init() - to keep init info together. */
tag -> complete = 1;
scl_free( tag );
}
#undef BASE_SELECT