From: Stephen Hemminger <stephen@networkplumber.org>
To: chixiaobo <xiaobo.chi@nokia.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] array malloced by backtrace_symbols() should be freed by the caller
Date: Tue, 4 Aug 2015 09:12:23 -0700 [thread overview]
Message-ID: <20150804091223.4e7142c6@urahara> (raw)
In-Reply-To: <1438679058-18324-1-git-send-email-xiaobo.chi@nokia.com>
On Tue, 4 Aug 2015 17:04:18 +0800
chixiaobo <xiaobo.chi@nokia.com> wrote:
> diff --git a/lib/librte_eal/linuxapp/eal/eal_debug.c b/lib/librte_eal/linuxapp/eal/eal_debug.c
> index 44fc4f3..ceca2e8 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_debug.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_debug.c
> @@ -58,6 +58,9 @@ void rte_dump_stack(void)
> "%d: [%s]\n", size, symb[size - 1]);
> size --;
> }
> + /* This array is malloced by backtrace_symbols(), and must be freed by the caller */
> + if( symb )
> + free( (void *)symb );
I agree that free() should probably be done, but am a little worried
that it just make things break. Since lots of times when this code is called
the malloc pool is in broken state because the whole reason for calling backtrace
is to handle panic situation.
Please use the standard white space style, and do not add a cast to void *
where none is required in C.
On a related note, I found that backtrace_symbols was rather poor at decoding
and finding many symbols. The unwind library does a better job.
prev parent reply other threads:[~2015-08-04 16:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 9:04 chixiaobo
2015-08-04 16:12 ` Stephen Hemminger [this message]
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=20150804091223.4e7142c6@urahara \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=xiaobo.chi@nokia.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;
as well as URLs for NNTP newsgroup(s).