in_hash_table = maybe_add_script (pspace_info->loaded_scripts, file,
opened ? full_path : NULL);
- if (opened)
- free (full_path);
-
if (! opened)
{
/* We don't throw an error, the program is still debuggable. */
GDBPY_AUTO_SECTION_NAME, objfile->name);
pspace_info->script_not_found_warning_printed = TRUE;
}
- continue;
}
-
- /* If this file is not currently loaded, load it. */
- if (! in_hash_table)
- source_python_script_for_objfile (objfile, stream, file);
+ else
+ {
+ /* If this file is not currently loaded, load it. */
+ if (! in_hash_table)
+ source_python_script_for_objfile (objfile, full_path);
+ fclose (stream);
+ xfree (full_path);
+ }
}
}
It's highly unlikely that we'd ever load it twice,
and these scripts are required to be idempotent under multiple
loads anyway. */
- source_python_script_for_objfile (objfile, input, debugfile);
+ source_python_script_for_objfile (objfile, debugfile);
fclose (input);
}
collect_matching_scripts (void **slot, void *info)
{
struct loaded_script *script = *slot;
- VEC (loaded_script_ptr) *scripts = info;
+ VEC (loaded_script_ptr) **scripts_ptr = info;
if (re_exec (script->name))
- VEC_safe_push (loaded_script_ptr, scripts, script);
+ VEC_safe_push (loaded_script_ptr, *scripts_ptr, script);
return 1;
}
if (pspace_info != NULL && pspace_info->loaded_scripts != NULL)
{
immediate_quit++;
+ /* Pass a pointer to scripts as VEC_safe_push can realloc space. */
htab_traverse_noresize (pspace_info->loaded_scripts,
- collect_matching_scripts, scripts);
+ collect_matching_scripts, &scripts);
immediate_quit--;
}