From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932735AbaEGMGx (ORCPT ); Wed, 7 May 2014 08:06:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32895 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932181AbaEGMGw (ORCPT ); Wed, 7 May 2014 08:06:52 -0400 Date: Wed, 7 May 2014 14:06:03 +0200 From: Jiri Olsa To: Jean Pihet Cc: Arnaldo Carvalho de Melo , will.deacon@arm.com, "linux-kernel@vger.kernel.org" , "linaro-kernel@lists.linaro.org" , "linux-arm-kernel@lists.infradead.org" , Corey Ashford , Frederic Weisbecker , Ingo Molnar , Namhyung Kim , Paul Mackerras , Peter Zijlstra , David Ahern Subject: Re: [PATCH 2/3] perf tests: Add dwarf unwind test on ARM Message-ID: <20140507120603.GC2019@krava.brq.redhat.com> References: <1399389979-11279-1-git-send-email-jean.pihet@linaro.org> <1399389979-11279-3-git-send-email-jean.pihet@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1399389979-11279-3-git-send-email-jean.pihet@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 06, 2014 at 05:26:18PM +0200, Jean Pihet wrote: SNIP > diff --git a/tools/perf/arch/arm/tests/dwarf-unwind.c b/tools/perf/arch/arm/tests/dwarf-unwind.c > new file mode 100644 > index 0000000..d618f5f > --- /dev/null > +++ b/tools/perf/arch/arm/tests/dwarf-unwind.c > @@ -0,0 +1,59 @@ > +#include > +#include "perf_regs.h" > +#include "thread.h" > +#include "map.h" > +#include "event.h" > +#include "tests/tests.h" > + > +#define STACK_SIZE 8192 > + > +static int sample_ustack(struct perf_sample *sample, > + struct thread *thread, u64 *regs) > +{ > + struct stack_dump *stack = &sample->user_stack; > + struct map *map; > + unsigned long sp; > + u64 stack_size, *buf; > + > + buf = malloc(STACK_SIZE); > + if (!buf) { > + pr_debug("failed to allocate sample uregs data\n"); > + return -1; > + } > + > + sp = (unsigned long) regs[PERF_REG_ARM_SP]; > + > + map = map_groups__find(&thread->mg, MAP__FUNCTION, (u64) sp); > + if (!map) { > + pr_debug("failed to get stack map\n"); > + return -1; > + } there's a memory leak of 'buf' already fixed fox x86: perf tests x86: Fix memory leak in sample_ustack() commit 763d7f5f2718f085bab5a9e63308349728f3ad12 Author: Masanari Iida Date: Sun Apr 20 00:16:41 2014 +0900 jirka