From: Pedro Alves <palves@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>, Tom Tromey <tom@tromey.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] PR gdb/17210 - fix possible memory leak in read_memory_robust
Date: Tue, 28 Jun 2016 17:48:00 -0000 [thread overview]
Message-ID: <39ec8a24-e86d-99f8-3fa0-d73e17d3a639@redhat.com> (raw)
In-Reply-To: <CAH=s-PMjZN9byLwAGs+yQjEhDzMJEe0RxGuT-tg89+DFxgk6ew@mail.gmail.com>
On 06/28/2016 11:42 AM, Yao Qi wrote:
> On Thu, Jun 9, 2016 at 5:33 PM, Tom Tromey <tom@tromey.com> wrote:
>>
>> VEC(memory_read_result_s) *
>> @@ -1810,6 +1810,8 @@ read_memory_robust (struct target_ops *ops,
>> {
>> VEC(memory_read_result_s) *result = 0;
>> int unit_size = gdbarch_addressable_memory_unit_size (target_gdbarch ());
>> + struct cleanup *cleanup = make_cleanup (free_memory_read_result_vector,
>> + &result);
>>
>
> result is a local variable on stack, so its address is meaningless when the
> exception is throw, because the stack has already been destroyed.
Can you clarify?
Cleanups do run before the stack is destroyed. See most
free_current_contents users.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2016-06-28 17:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 16:34 Tom Tromey
2016-06-28 10:43 ` Yao Qi
2016-06-28 14:40 ` Tom Tromey
2016-06-28 17:48 ` Pedro Alves [this message]
2016-06-29 9:27 ` Yao Qi
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=39ec8a24-e86d-99f8-3fa0-d73e17d3a639@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=qiyaoltc@gmail.com \
--cc=tom@tromey.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