Change parser_t::parse_job's args array to be a local, rather than just leak it, which no longer seems to crash

This commit is contained in:
ridiculousfish
2012-01-31 16:50:03 -08:00
parent af2d348543
commit 0c9e398bef
7 changed files with 43 additions and 41 deletions

View File

@@ -2599,7 +2599,6 @@ static int builtin_cd( parser_t &parser, wchar_t **argv )
env_var_t dir_in;
wchar_t *dir;
int res=STATUS_BUILTIN_OK;
void *context = halloc( 0, 0 );
if( argv[1] == 0 )
@@ -2615,7 +2614,7 @@ static int builtin_cd( parser_t &parser, wchar_t **argv )
else
dir_in = argv[1];
dir = path_get_cdpath( context, dir_in.missing() ? NULL : dir_in.c_str() );
dir = path_allocate_cdpath( dir_in.missing() ? NULL : dir_in.c_str() );
if( !dir )
{
@@ -2698,7 +2697,7 @@ static int builtin_cd( parser_t &parser, wchar_t **argv )
sb_printf( sb_err, _( L"%ls: Could not set PWD variable\n" ), argv[0] );
}
halloc_free( context );
free(dir);
return res;
}