All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	"Steven Rostedt (Red Hat)" <rostedt@goodmis.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/11] tools lib traceevent: Set int_array fields to NULL if freeing from error
Date: Wed,  2 Mar 2016 19:16:41 -0300	[thread overview]
Message-ID: <1456957006-3757-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1456957006-3757-1-git-send-email-acme@kernel.org>

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

Had a bug where on error of parsing __print_array() where the fields are
freed after they were allocated, but since they were not set to NULL,
the freeing of the arg also tried to free the already freed fields
causing a double free.

Fix process_hex() while at it.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20160209204237.188327674@goodmis.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index ce59f4891fa2..fb790aa757eb 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2635,6 +2635,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
 
 free_field:
 	free_arg(arg->hex.field);
+	arg->hex.field = NULL;
 out:
 	*tok = NULL;
 	return EVENT_ERROR;
@@ -2659,8 +2660,10 @@ process_int_array(struct event_format *event, struct print_arg *arg, char **tok)
 
 free_size:
 	free_arg(arg->int_array.count);
+	arg->int_array.count = NULL;
 free_field:
 	free_arg(arg->int_array.field);
+	arg->int_array.field = NULL;
 out:
 	*tok = NULL;
 	return EVENT_ERROR;
-- 
2.5.0

  parent reply	other threads:[~2016-03-02 22:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-02 22:16 [GIT PULL 00/11] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 01/11] perf stat: Implement CSV metrics output Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 02/11] perf stat: Support metrics in --per-core/socket mode Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 03/11] tools build: Use .s extension for preprocessed assembler code Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 04/11] perf script: Fix double free on command_line Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 05/11] tools lib traceevent: Fix time stamp rounding issue Arnaldo Carvalho de Melo
2016-03-02 22:16 ` Arnaldo Carvalho de Melo [this message]
2016-03-02 22:16 ` [PATCH 07/11] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 08/11] perf test: Fix hists related entries Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 09/11] perf tests: Initialize sa.sa_flags Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 10/11] tools/power turbostat: fix various build warnings Arnaldo Carvalho de Melo
2016-03-02 22:16 ` [PATCH 11/11] perf stat: Check for frontend stalled for metrics Arnaldo Carvalho de Melo

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=1456957006-3757-7-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.