* cli/cli-cmds.c (source_script): Clean up full_pathname. Run
authorTom Tromey <tromey@redhat.com>
Mon, 10 Nov 2008 20:38:24 +0000 (20:38 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 10 Nov 2008 20:38:24 +0000 (20:38 +0000)
cleanups on early return.

gdb/ChangeLog
gdb/cli/cli-cmds.c

index 704c2937f64c4612f271f6d5386468ff1761a184..090a9424fdf464ddde3c23d45a8cce6115d3ef3c 100644 (file)
@@ -1,3 +1,8 @@
+2008-11-10  Tom Tromey  <tromey@redhat.com>
+
+       * cli/cli-cmds.c (source_script): Clean up full_pathname.  Run
+       cleanups on early return.
+
 2008-11-09  Vladimir Prus  <vladimir@codesourcery.com>
 
        Kill pthread_ops_hack
index d9d2c56b5a5a7de5a421638d0dbed14eedb27d10..21a64a0e951d4e48964f8919492e686c07f53c59 100644 (file)
@@ -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);
This page took 0.039103 seconds and 4 git commands to generate.