fix one bug in symfile.c
authorTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:21:15 +0000 (17:21 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 30 May 2013 17:21:15 +0000 (17:21 +0000)
find_separate_debug_file could leak a cleanup along some return paths.

* symfile.c (find_separate_debug_file): Call do_cleanups
along all return paths.

gdb/ChangeLog
gdb/symfile.c

index 5331d5b..e3e8aa2 100644 (file)
@@ -1,5 +1,10 @@
 2013-05-30  Tom Tromey  <tromey@redhat.com>
 
+       * symfile.c (find_separate_debug_file): Call do_cleanups
+       along all return paths.
+
+2013-05-30  Tom Tromey  <tromey@redhat.com>
+
        * symtab.c (search_symbols): Introduce a null cleanup for
        'retval_chain'.
 
index 360f999..c2ad797 100644 (file)
@@ -1428,7 +1428,10 @@ find_separate_debug_file (const char *dir,
       strcat (debugfile, debuglink);
 
       if (separate_debug_file_exists (debugfile, crc32, objfile))
-       return debugfile;
+       {
+         do_cleanups (back_to);
+         return debugfile;
+       }
 
       /* If the file is in the sysroot, try using its base path in the
         global debugfile directory.  */
@@ -1443,7 +1446,10 @@ find_separate_debug_file (const char *dir,
          strcat (debugfile, debuglink);
 
          if (separate_debug_file_exists (debugfile, crc32, objfile))
-           return debugfile;
+           {
+             do_cleanups (back_to);
+             return debugfile;
+           }
        }
     }