summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-11-10 20:38:24 +0000
committerTom Tromey <tromey@redhat.com>2008-11-10 20:38:24 +0000
commitb03a6ea40ebd65be04d15eca28db52d37e816270 (patch)
tree7467d4d2e56d8628e81e8219642239720c461793 /gdb/cli
parent17ceb936752c300b333b579762f1eb757e94a69e (diff)
downloadbinutils-gdb-b03a6ea40ebd65be04d15eca28db52d37e816270.tar.gz
* cli/cli-cmds.c (source_script): Clean up full_pathname. Run
cleanups on early return.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-cmds.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index d9d2c56b5a5..21a64a0e951 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -450,6 +450,7 @@ source_script (char *file, int from_tty)
files. Put the full location in 'full_pathname'. */
fd = openp (source_path, OPF_TRY_CWD_FIRST,
file, O_RDONLY, 0, &full_pathname);
+ make_cleanup (xfree, full_pathname);
/* Use the full path name, if it is found. */
if (full_pathname != NULL && fd != -1)
@@ -462,7 +463,10 @@ source_script (char *file, int from_tty)
if (from_tty)
perror_with_name (file);
else
- return;
+ {
+ do_cleanups (old_cleanups);
+ return;
+ }
}
stream = fdopen (fd, FOPEN_RT);