|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77725 - trunk/tools/build/v2/engine
From: steven_at_[hidden]
Date: 2012-04-02 18:00:33
Author: steven_watanabe
Date: 2012-04-02 18:00:32 EDT (Mon, 02 Apr 2012)
New Revision: 77725
URL: http://svn.boost.org/trac/boost/changeset/77725
Log:
Fix memory errors with BJAM_NO_MEM_CACHE.
Text files modified:
trunk/tools/build/v2/engine/function.c | 20 ++++++++++++++++----
trunk/tools/build/v2/engine/modules.c | 11 +++++++++++
2 files changed, 27 insertions(+), 4 deletions(-)
Modified: trunk/tools/build/v2/engine/function.c
==============================================================================
--- trunk/tools/build/v2/engine/function.c (original)
+++ trunk/tools/build/v2/engine/function.c 2012-04-02 18:00:32 EDT (Mon, 02 Apr 2012)
@@ -2923,7 +2923,7 @@
if ( is_type_name( object_str( arg ) ) )
{
- c->arg.type_name = arg;
+ c->arg.type_name = object_copy( arg );
c->state = ARGUMENT_COMPILER_FOUND_TYPE;
break;
}
@@ -2937,7 +2937,7 @@
exit( 1 );
}
- c->arg.arg_name = arg;
+ c->arg.arg_name = object_copy( arg );
if ( object_equal( arg, constant_star ) )
{
c->arg.flags = ARG_VARIADIC;
@@ -3066,12 +3066,15 @@
argument_compiler_init( arg_comp );
for ( ; *args; ++args )
{
+ OBJECT * token;
if ( strcmp( *args, ":" ) == 0 )
{
++args;
break;
}
- argument_compiler_add( arg_comp, object_new( *args ), constant_builtin, -1 );
+ token = object_new( *args );
+ argument_compiler_add( arg_comp, token, constant_builtin, -1 );
+ object_free( token );
}
arg = arg_compile_impl( arg_comp, constant_builtin, -1 );
dynamic_array_push( c->args, arg );
@@ -3129,6 +3132,9 @@
for ( j = 0; j < formal[ i ].size; ++j )
{
args[ j ] = formal[ i ].args[ j ];
+ if ( args[ j ].type_name )
+ args[ j ].type_name = object_copy( args[ j ].type_name );
+ args[ j ].arg_name = object_copy( args[ j ].arg_name );
if ( args[ j ].flags != ARG_VARIADIC )
{
args[ j ].index = module_add_fixed_var( module, args[ j ].arg_name, counter );
@@ -3149,9 +3155,15 @@
void argument_list_free( struct arg_list * args, int args_count )
{
- int i;
+ int i, j;
for ( i = 0; i < args_count; ++i )
{
+ for ( j = 0; j < args[ i ].size; ++j )
+ {
+ if ( args[ i ].args[ j ].type_name )
+ object_free( args[ i ].args[ j ].type_name );
+ object_free( args[ i ].args[ j ].arg_name );
+ }
BJAM_FREE( args[ i ].args );
}
BJAM_FREE( args );
Modified: trunk/tools/build/v2/engine/modules.c
==============================================================================
--- trunk/tools/build/v2/engine/modules.c (original)
+++ trunk/tools/build/v2/engine/modules.c 2012-04-02 18:00:32 EDT (Mon, 02 Apr 2012)
@@ -93,6 +93,7 @@
object_free( *(OBJECT * *)xmodule_name );
}
+static void free_fixed_variable( void * xvar, void * data );
void delete_module( module_t * m )
{
@@ -126,6 +127,11 @@
}
BJAM_FREE( m->fixed_variables );
m->fixed_variables = 0;
+ }
+
+ if ( m->variable_indices )
+ {
+ hashenumerate( m->variable_indices, &free_fixed_variable, (void *)0 );
hash_free( m->variable_indices );
m->variable_indices = 0;
}
@@ -324,6 +330,11 @@
int counter;
};
+static void free_fixed_variable( void * xvar, void * data )
+{
+ object_free( ( (struct fixed_variable *)xvar )->key );
+}
+
static void bind_variables_for_rule( void * xrule, void * xdata )
{
RULE * rule = (RULE *)xrule;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk