aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-auto-load.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-auto-load.c')
-rw-r--r--gdb/python/py-auto-load.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/python/py-auto-load.c b/gdb/python/py-auto-load.c
index 158b1cb..75fa041 100644
--- a/gdb/python/py-auto-load.c
+++ b/gdb/python/py-auto-load.c
@@ -296,9 +296,6 @@ source_section_scripts (struct objfile *objfile, const char *source_name,
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. */
@@ -310,12 +307,15 @@ Use `info auto-load-scripts [REGEXP]' to list them."),
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, stream, file);
+ fclose (stream);
+ free (full_path);
+ }
}
}