From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Checked in: [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list]
Date: Tue, 21 May 2013 05:44:00 -0000 [thread overview]
Message-ID: <20130521054426.GA19975@adacore.com> (raw)
In-Reply-To: <20130521054334.GV4017@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
> Cool, thanks! Attached is what I checked in, after a round of testing on
> x86_64-linux.
>
> gdb/ChangeLog:
>
> * ada-lang.c (old_renaming_is_invisible): Fix cleanup leak.
>
> Thanks again for pointing this cleanup leak out.
Really attached, this time...
--
Joel
[-- Attachment #2: 0001-Ada-Fix-cleanup-leak-in-ada-lang.c-old_renaming_is_i.patch --]
[-- Type: text/x-diff, Size: 2052 bytes --]
From aea9d783272e628dea85555ebebc0f3891fd5f77 Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
Date: Tue, 21 May 2013 09:40:01 +0400
Subject: [PATCH] [Ada] Fix cleanup leak in
ada-lang.c:old_renaming_is_invisible
gdb/ChangeLog:
* ada-lang.c (old_renaming_is_invisible): Fix cleanup leak.
---
gdb/ChangeLog | 4 ++++
gdb/ada-lang.c | 16 ++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 19a4cd6..c48f7e7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2013-05-21 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (old_renaming_is_invisible): Fix cleanup leak.
+
2013-05-21 Hui Zhu <hui@codesourcery.com>
* breakpoint.c (dprintf_breakpoint_ops): Remove its static.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index fa6db0f..b6d5e0b 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -4726,17 +4726,20 @@ static int
old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
{
char *scope;
+ struct cleanup *old_chain;
if (SYMBOL_CLASS (sym) != LOC_TYPEDEF)
return 0;
scope = xget_renaming_scope (SYMBOL_TYPE (sym));
-
- make_cleanup (xfree, scope);
+ old_chain = make_cleanup (xfree, scope);
/* If the rename has been defined in a package, then it is visible. */
if (is_package_name (scope))
- return 0;
+ {
+ do_cleanups (old_chain);
+ return 0;
+ }
/* Check that the rename is in the current function scope by checking
that its name starts with SCOPE. */
@@ -4748,7 +4751,12 @@ old_renaming_is_invisible (const struct symbol *sym, const char *function_name)
if (strncmp (function_name, "_ada_", 5) == 0)
function_name += 5;
- return (strncmp (function_name, scope, strlen (scope)) != 0);
+ {
+ int is_invisible = strncmp (function_name, scope, strlen (scope)) != 0;
+
+ do_cleanups (old_chain);
+ return is_invisible;
+ }
}
/* Remove entries from SYMS that corresponds to a renaming entity that
--
1.7.10.4
next prev parent reply other threads:[~2013-05-21 5:44 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 19:46 [RFC] Cleanup for make_source_files_completion_list Keith Seitz
2013-05-09 20:58 ` Tom Tromey
2013-05-09 23:45 ` Doug Evans
2013-05-13 18:42 ` Keith Seitz
2013-05-13 21:11 ` Keith Seitz
2013-05-15 17:36 ` Keith Seitz
2013-05-15 19:32 ` [RFA] completer test [was Re: [RFC] Cleanup for make_source_files_completion_list] Keith Seitz
2013-05-15 20:01 ` Tom Tromey
2013-05-15 21:22 ` Keith Seitz
2013-05-15 22:33 ` Sergio Durigan Junior
2013-05-15 23:47 ` Keith Seitz
2013-05-16 0:21 ` Sergio Durigan Junior
2013-05-16 0:27 ` Stan Shebs
2013-05-16 9:38 ` Pedro Alves
2013-05-16 5:30 ` Joel Brobecker
2013-05-16 5:49 ` Joel Brobecker
2013-05-16 15:41 ` Keith Seitz
2013-05-17 5:14 ` Joel Brobecker
2013-05-17 16:27 ` Tom Tromey
2013-05-20 5:28 ` Joel Brobecker
2013-05-20 14:47 ` Tom Tromey
2013-05-21 5:43 ` Checked in: " Joel Brobecker
2013-05-21 5:44 ` Joel Brobecker [this message]
2013-05-16 5:53 ` Sergio Durigan Junior
2013-05-16 6:00 ` Joel Brobecker
2013-05-16 9:19 ` Pedro Alves
2013-05-16 9:26 ` Joel Brobecker
2013-05-16 10:18 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130521054426.GA19975@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox