From a991ac289d2074310c8746ada6df5f67bdd27222 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 30 May 2013 17:21:15 +0000 Subject: [PATCH] fix one bug in symfile.c 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 | 5 +++++ gdb/symfile.c | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5331d5b..e3e8aa2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2013-05-30 Tom Tromey + * symfile.c (find_separate_debug_file): Call do_cleanups + along all return paths. + +2013-05-30 Tom Tromey + * symtab.c (search_symbols): Introduce a null cleanup for 'retval_chain'. diff --git a/gdb/symfile.c b/gdb/symfile.c index 360f999..c2ad797 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -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; + } } } -- 2.7.4