From: Ian Lance Taylor <iant@google.com>
To: Andrew Burgess <aburgess@broadcom.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
Jason Merrill <jason@redhat.com>,
gdb-patches@sourceware.org
Subject: Re: [PATCH] cplus-demangler, free resource after a failed call to gnu_special.
Date: Mon, 12 May 2014 05:40:00 -0000 [thread overview]
Message-ID: <CAKOQZ8wBvHe6KdWDuipPmSu=6hrJZ88xDHMyP_B2sHc-4L3qNg@mail.gmail.com> (raw)
In-Reply-To: <536E7A72.1040203@broadcom.com>
On Sat, May 10, 2014 at 12:13 PM, Andrew Burgess <aburgess@broadcom.com> wrote:
> On 09/05/2014 9:53 PM, Ian Lance Taylor wrote:
>> On Fri, May 9, 2014 at 7:35 AM, Andrew Burgess <aburgess@broadcom.com> wrote:
>>
>>> if ((AUTO_DEMANGLING || GNU_DEMANGLING))
>>> {
>>> success = gnu_special (work, &mangled, &decl);
>>> + if (!success)
>>> + {
>>> + delete_work_stuff (work);
>>> + string_delete (&decl);
>>> + }
>>
>> As far as I can see, decl may be uninitialized at this point. I don't
>> think you can call string_delete. You need to ensure that decl is
>> initialized somehow.
>
> There's a call to string_init on decl about 10 lines above the
> above diff, just outside of context, but it's unconditional, so
> I figured that would be enough.
>
> Also, if gnu_special returns false, and the call to
> demangle_prefix returns false then we call (near the bottom of
> internal_cplus_demangle) mop_up, which calls string_delete.
>
> Given that decl is initialised once, assuming that the string is
> only released using delete_string then the internal state will
> have been reset back to NULL, so calling delete_string should
> be safe again.
Right, sorry for the noise.
This patch is OK.
Thanks.
Ian
next prev parent reply other threads:[~2014-05-12 5:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 14:35 Andrew Burgess
2014-05-09 20:53 ` Ian Lance Taylor
2014-05-10 19:14 ` Andrew Burgess
2014-05-12 5:40 ` Ian Lance Taylor [this message]
2014-05-14 9:01 ` Gary Benson
2014-05-14 9:30 ` Andrew Burgess
2014-05-14 14:20 ` Gary Benson
2014-05-22 11:58 ` Thomas Schwinge
2014-05-22 16:02 ` Gary Benson
2014-05-22 16:13 ` Thomas Schwinge
2014-05-22 19:34 ` Gary Benson
2014-05-28 22:17 ` 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='CAKOQZ8wBvHe6KdWDuipPmSu=6hrJZ88xDHMyP_B2sHc-4L3qNg@mail.gmail.com' \
--to=iant@google.com \
--cc=aburgess@broadcom.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=jason@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