From: Stan Shebs <stan@codesourcery.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Stan Shebs <stan@codesourcery.com>
Subject: Re: [PATCH/commit] Handle errors in tracepoint target agent
Date: Fri, 26 Mar 2010 12:50:00 -0000 [thread overview]
Message-ID: <4BACAD8F.3030909@codesourcery.com> (raw)
In-Reply-To: <201003261140.09071.pedro@codesourcery.com>
Pedro Alves wrote:
> On Friday 26 March 2010 01:55:50, Stan Shebs wrote:
>
>> The error message is never NULL, I added the MI
>> status bit overlooked before,
>>
>
> But now, `error_desc' is leaking in the case you xmalloc it.
>
It was leaking before. :-) It needs to stick around indefinitely; it
guess it would work to free an old one just before allocating a new one.
> When you fix that leak, you'll stumble of the fact that
> in some cases you have this:
>
> ts->error_desc = ""
>
> while in others you have this:
>
> ts->error_desc = (char *) xmalloc (p2 - p1 + 1);
>
No, because the p2 != p1 test prior ensures we only allocate non-empty
strings.
> How can you reliably know if you may xfree
> ts->error_desc that way? xfree ("") is a no go.
> Comparing a pointer with "" is also not good.
>
strlen.
Stan
next prev parent reply other threads:[~2010-03-26 12:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 1:56 Stan Shebs
2010-03-26 11:13 ` Pedro Alves
2010-03-26 12:40 ` Stan Shebs
2010-03-26 13:38 ` Pedro Alves
2010-03-26 14:17 ` Pedro Alves
2010-03-26 11:40 ` Pedro Alves
2010-03-26 12:50 ` Stan Shebs [this message]
2010-03-26 14:44 ` Pedro Alves
2010-03-26 15:20 ` Stan Shebs
2010-03-26 15:28 ` Eli Zaretskii
2010-03-26 15:53 ` Daniel Jacobowitz
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=4BACAD8F.3030909@codesourcery.com \
--to=stan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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