Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1350840 > unrolled thread

[tip:perf/core] tools lib traceevent: Set int_array fields to NULL if freeing from error

Started by"tip-bot for Steven Rostedt (Red Hat)" <tipbot@zytor.com>
First post2016-03-05 09:30 +0100
Last post2016-03-05 09:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [tip:perf/core] tools lib traceevent: Set int_array fields to NULL  if freeing from error "tip-bot for Steven Rostedt (Red Hat)" <tipbot@zytor.com> - 2016-03-05 09:30 +0100

#1350840 — [tip:perf/core] tools lib traceevent: Set int_array fields to NULL if freeing from error

From"tip-bot for Steven Rostedt (Red Hat)" <tipbot@zytor.com>
Date2016-03-05 09:30 +0100
Subject[tip:perf/core] tools lib traceevent: Set int_array fields to NULL if freeing from error
Message-ID<r9fL4-3nX-1@gated-at.bofh.it>
Commit-ID:  9ec72eafee61f68cd57310a99db129ffb71302f3
Gitweb:     http://git.kernel.org/tip/9ec72eafee61f68cd57310a99db129ffb71302f3
Author:     Steven Rostedt (Red Hat) <rostedt@goodmis.org>
AuthorDate: Tue, 9 Feb 2016 15:40:16 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 3 Mar 2016 11:10:38 -0300

tools lib traceevent: Set int_array fields to NULL if freeing from error

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 ce59f48..fb790aa 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;

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web