Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1272637
| From | Arnaldo Carvalho de Melo <acme@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame |
| Date | 2015-11-18 23:40 +0100 |
| Message-ID | <qwjyq-RO-13@gated-at.bofh.it> (permalink) |
| References | <qw4J3-7HS-3@gated-at.bofh.it> <qw4J4-7HS-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Em Wed, Nov 18, 2015 at 03:40:12PM +0900, Masami Hiramatsu escreveu:
> Since dwarf_cfi_addrframe returns malloc'd Dwarf_Frame
> object, it has to be freed after used.
Applied to perf/urgent
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> ---
> tools/perf/util/probe-finder.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index 63993d7..4d7d4f4 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -683,21 +683,24 @@ static int call_probe_finder(Dwarf_Die *sc_die, struct probe_finder *pf)
> ret = dwarf_getlocation_addr(&fb_attr, pf->addr, &pf->fb_ops, &nops, 1);
> if (ret <= 0 || nops == 0) {
> pf->fb_ops = NULL;
> + ret = 0;
> #if _ELFUTILS_PREREQ(0, 142)
> } else if (nops == 1 && pf->fb_ops[0].atom == DW_OP_call_frame_cfa &&
> pf->cfi != NULL) {
> - Dwarf_Frame *frame;
> + Dwarf_Frame *frame = NULL;
> if (dwarf_cfi_addrframe(pf->cfi, pf->addr, &frame) != 0 ||
> dwarf_frame_cfa(frame, &pf->fb_ops, &nops) != 0) {
> pr_warning("Failed to get call frame on 0x%jx\n",
> (uintmax_t)pf->addr);
> - return -ENOENT;
> + ret = -ENOENT;
> }
> + free(frame);
> #endif
> }
>
> /* Call finder's callback handler */
> - ret = pf->callback(sc_die, pf);
> + if (ret >= 0)
> + ret = pf->callback(sc_die, pf);
>
> /* *pf->fb_ops will be cached in libdw. Don't free it. */
> pf->fb_ops = NULL;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> - 2015-11-18 07:50 +0100
Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-11-18 23:40 +0100
Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Namhyung Kim <namhyung@gmail.com> - 2015-11-19 00:40 +0100
RE: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame 平松雅巳 / HIRAMATU,MASAMI <masami.hiramatsu.pt@hitachi.com> - 2015-11-19 04:20 +0100
Re: [PATCH perf/core 01/13] perf probe: Fix to free temporal Dwarf_Frame Namhyung Kim <namhyung@kernel.org> - 2015-11-20 02:50 +0100
[tip:perf/core] perf probe: Fix to free temporal Dwarf_Frame tip-bot for Masami Hiramatsu <tipbot@zytor.com> - 2015-11-23 17:20 +0100
csiph-web