[PATCH 23/40] fix one bug in symfile.c

Tom Tromey
2013-05-09T18:51:54Z

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/symfile.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gdb/symfile.c b/gdb/symfile.c
index f93d857..7781dfa 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1469,7 +1469,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. */
@@ -1484,7 +1487,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;
+ }
}
}

--
1.8.1.4