Protect against double-free of the process argument list

darcs-hash:20060222175107-ac50b-87c36439e2ec2f8be652db1595dad9a09e20f36c.gz
This commit is contained in:
axel 2006-02-23 03:51:07 +10:00
parent 68e0c94dbb
commit 1a48941f6b

View File

@ -1352,7 +1352,8 @@ static void parse_job_main_loop( process_t *p,
return; return;
} }
p->pipe_fd = wcstol( tok_last( tok ), 0, 10 ); p->pipe_fd = wcstol( tok_last( tok ), 0, 10 );
halloc_register( j, p->argv=list_to_char_arr( args ) ); if( !p->argv )
halloc_register( j, p->argv = list_to_char_arr( args ) );
p->next = halloc( j, sizeof( process_t ) ); p->next = halloc( j, sizeof( process_t ) );
if( p->next == 0 ) if( p->next == 0 )
{ {
@ -1376,7 +1377,8 @@ static void parse_job_main_loop( process_t *p,
case TOK_END: case TOK_END:
{ {
halloc_register( j, p->argv=list_to_char_arr( args ) ); if( !p->argv )
halloc_register( j, p->argv = list_to_char_arr( args ) );
if( tok_has_next(tok)) if( tok_has_next(tok))
tok_next(tok); tok_next(tok);
@ -2086,8 +2088,8 @@ static int parse_job( process_t *p,
{ {
if( p->type == INTERNAL_BUILTIN && parser_skip_arguments( (wchar_t *)al_get(args, 0) ) ) if( p->type == INTERNAL_BUILTIN && parser_skip_arguments( (wchar_t *)al_get(args, 0) ) )
{ {
halloc_register( j, p->argv = list_to_char_arr( args ) ); if( !p->argv )
// tok_next(tok); halloc_register( j, p->argv = list_to_char_arr( args ) );
} }
else else
{ {