From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from demumfd001.nsn-inter.net (demumfd001.nsn-inter.net [93.183.12.32]) by dpdk.org (Postfix) with ESMTP id D67E8C342 for ; Tue, 4 Aug 2015 12:21:08 +0200 (CEST) Received: from demuprx017.emea.nsn-intra.net ([10.150.129.56]) by demumfd001.nsn-inter.net (8.15.1/8.15.1) with ESMTPS id t74AL8r4007723 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 4 Aug 2015 10:21:08 GMT Received: from localhost ([10.140.178.105]) by demuprx017.emea.nsn-intra.net (8.12.11.20060308/8.12.11) with ESMTP id t74AL60K005520; Tue, 4 Aug 2015 12:21:07 +0200 From: chixiaobo To: dev@dpdk.org Date: Tue, 4 Aug 2015 18:21:06 +0800 Message-Id: <1438683666-21196-1-git-send-email-xiaobo.chi@nokia.com> X-Mailer: git-send-email 1.9.4.msysgit.2 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: clean X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate-size: 1554 X-purgate-ID: 151667::1438683668-000058E2-E44CC0FC/0/0 Cc: chixiaobo Subject: [dpdk-dev] [dpdk_dev][PATCH] array malloced by backtrace_symbols() should be freed by the caller X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2015 10:21:09 -0000 As to linux man page: http://linux.die.net/man/3/backtrace_symbols, The address of the array of string pointers is returned as the function result of backtrace_symbols(). This array is malloced by backtrace_symbols(), and must be freed by the caller. The strings pointed to by the array of pointers need not and should not be freed. Signed-off-by: chixiaobo --- lib/librte_eal/bsdapp/eal/eal_debug.c | 3 +++ lib/librte_eal/linuxapp/eal/eal_debug.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/librte_eal/bsdapp/eal/eal_debug.c b/lib/librte_eal/bsdapp/eal/eal_debug.c index 44fc4f3..ceca2e8 100644 --- a/lib/librte_eal/bsdapp/eal/eal_debug.c +++ b/lib/librte_eal/bsdapp/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 ); } /* not implemented in this environment */ 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 ); } /* not implemented in this environment */ -- 1.9.4.msysgit.2