aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-auto-load.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2011-09-19 19:01:40 +0000
committerDoug Evans <dje@google.com>2011-09-19 19:01:40 +0000
commit562f943bccc5f35b000983a1aa9f9a8af7b3cad0 (patch)
tree098c1a94f04ce0dd792178951dc80ddef06ed6e2 /gdb/python/py-auto-load.c
parent3c9057f3816867fcf94bec3e264c2b7b0873fd29 (diff)
downloadgdb-562f943bccc5f35b000983a1aa9f9a8af7b3cad0.zip
gdb-562f943bccc5f35b000983a1aa9f9a8af7b3cad0.tar.gz
gdb-562f943bccc5f35b000983a1aa9f9a8af7b3cad0.tar.bz2
* python/py-auto-load.c (source_section_scripts): Fix file
descriptor leak. * python/python.c (source_python_script_for_objfile): Tweak comments.
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);
+ }
}
}