Remove two minor memory leaks

darcs-hash:20060514223903-ac50b-4e764c460effd8c45493acfe5682626c3711c77e.gz
This commit is contained in:
axel
2006-05-15 08:39:03 +10:00
parent 5a7a264b96
commit dbb66e1895
3 changed files with 10 additions and 8 deletions

View File

@@ -1422,7 +1422,6 @@ static int builtin_read( wchar_t **argv )
case L'?':
builtin_print_help( argv[0], sb_err );
return 1;
}

View File

@@ -1983,7 +1983,8 @@ void complete( const wchar_t *cmd,
{
if( parser_is_subcommand( tok_last( &tok ) ) )
break;
free( current_command );
current_command = wcsdup( tok_last( &tok ) );
on_command = (pos <= tok_get_pos( &tok) + wcslen( tok_last( &tok ) ) );
@@ -2050,11 +2051,12 @@ void complete( const wchar_t *cmd,
}
}
free( current_token );
free( current_command );
free( prev_token );
}
free( current_token );
free( current_command );
free( prev_token );
error_max=old_error_max;
condition_cache_clear();

View File

@@ -2107,12 +2107,13 @@ static int parse_job( process_t *p,
{
int end_pos = end-tok_string( tok );
wchar_t *sub_block= wcsndup( tok_string( tok ) + current_tokenizer_pos,
end_pos - current_tokenizer_pos);
wchar_t *sub_block= halloc_wcsndup( j,
tok_string( tok ) + current_tokenizer_pos,
end_pos - current_tokenizer_pos);
p->type = INTERNAL_BLOCK;
al_set( args, 0, sub_block );
tok_set_pos( tok,
end_pos );