2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-13 00:12:11 +00:00

Fix memory leak on cygwin and vms. path_copy initializes a new string. It should never be used on a string that is already initialized.

This commit is contained in:
Steven Watanabe
2016-03-01 11:32:34 -07:00
parent 9da5a06af8
commit f5e005e8f3
2 changed files with 16 additions and 5 deletions

View File

@@ -345,7 +345,8 @@ static int translate_path_cyg2win( string * path )
if ( result )
{
string_copy( path, result );
string_truncate( path, 0 );
string_append( path, result );
translated = 1;
}

View File

@@ -174,15 +174,25 @@ static int translate_path_posix2vms( string * path )
&& stat(as_file->value, &statbuf ) > 0
&& ( statbuf.st_mode & S_IFREG ) )
{
string_copy( path, as_file->value );
string_truncate( path, 0 );
string_append( path, as_file->value );
}
else
{
string_copy( path, as_dir->value );
string_truncate( path, 0 );
string_append( path, as_dir->value );
}
}
else if ( file_count ) { string_copy( path, as_file->value ); }
else if ( dir_count ) { string_copy( path, as_dir->value ); }
else if ( file_count )
{
string_truncate( path, 0 );
string_append( path, as_file->value );
}
else if ( dir_count )
{
string_truncate( path, 0 );
string_append( path, as_dir->value );
}
else
{
/* error: unable to translate path to native format */