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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user