mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 06:05:39 +08:00
Fix concurrency bug in autoloader causing memory leak
darcs-hash:20060828162734-ac50b-76c88ba8cc164646dcff16cb899633f1e10392e2.gz
This commit is contained in:
parent
f5f15f9de2
commit
7df536023b
19
parse_util.c
19
parse_util.c
|
@ -592,7 +592,7 @@ int parse_util_load( const wchar_t *cmd,
|
|||
void (*on_load)(const wchar_t *cmd),
|
||||
int reload )
|
||||
{
|
||||
static array_list_t *path_list=0;
|
||||
array_list_t *path_list=0;
|
||||
|
||||
autoload_t *loaded;
|
||||
|
||||
|
@ -678,14 +678,11 @@ int parse_util_load( const wchar_t *cmd,
|
|||
}
|
||||
|
||||
|
||||
if( !path_list )
|
||||
path_list = al_halloc( global_context);
|
||||
|
||||
al_truncate( path_list, 0 );
|
||||
path_list = al_new( global_context);
|
||||
|
||||
tokenize_variable_array( path_var, path_list );
|
||||
|
||||
c = hash_get_count( &loaded->is_loading );
|
||||
c = al_get_count( path_list );
|
||||
|
||||
hash_put( &loaded->is_loading, cmd, cmd );
|
||||
|
||||
|
@ -700,14 +697,16 @@ int parse_util_load( const wchar_t *cmd,
|
|||
*/
|
||||
hash_remove( &loaded->is_loading, cmd, 0, 0 );
|
||||
|
||||
c2 = al_get_count( path_list );
|
||||
|
||||
al_foreach( path_list, &free );
|
||||
al_truncate( path_list, 0 );
|
||||
|
||||
al_destroy( path_list );
|
||||
free( path_list );
|
||||
|
||||
/**
|
||||
Make sure we didn't 'drop' something
|
||||
*/
|
||||
|
||||
c2 = hash_get_count( &loaded->is_loading );
|
||||
|
||||
assert( c == c2 );
|
||||
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue
Block a user