|
Boost-Commit : |
From: jurko.gospodnetic_at_[hidden]
Date: 2008-06-03 19:23:50
Author: jurko
Date: 2008-06-03 19:23:49 EDT (Tue, 03 Jun 2008)
New Revision: 46105
URL: http://svn.boost.org/trac/boost/changeset/46105
Log:
Corrected a potential memory leak in Boost Jam's builtin_shell() function that would appear should Boost Jam ever start to release its allocated string objects. Minor stylistic changes.
Text files modified:
trunk/tools/jam/src/builtins.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
Modified: trunk/tools/jam/src/builtins.c
==============================================================================
--- trunk/tools/jam/src/builtins.c (original)
+++ trunk/tools/jam/src/builtins.c 2008-06-03 19:23:49 EDT (Tue, 03 Jun 2008)
@@ -1881,14 +1881,17 @@
}
}
- string_new( &s );
-
- fflush(NULL);
+ /* The following fflush() call seems to be indicated as a workaround for
+ popen() bug on POSIX implementations realted to synhronizing input stream
+ positions for the called and the calling process. */
+ fflush( NULL );
- p = popen(command->string, "r");
+ p = popen( command->string, "r" );
if ( p == NULL )
return L0;
+ string_new( &s );
+
while ( (ret = fread(buffer, sizeof(char), sizeof(buffer)-1, p)) > 0 )
{
buffer[ret] = 0;
@@ -1898,7 +1901,7 @@
}
}
- exit_status = pclose(p);
+ exit_status = pclose( p );
/* The command output is returned first. */
result = list_new( L0, newstr(s.value) );
@@ -1907,7 +1910,7 @@
/* The command exit result next. */
if ( exit_status_opt )
{
- sprintf (buffer, "%d", exit_status);
+ sprintf( buffer, "%d", exit_status );
result = list_new( result, newstr( buffer ) );
}
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