From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760740AbcCEIT7 (ORCPT ); Sat, 5 Mar 2016 03:19:59 -0500 Received: from torg.zytor.com ([198.137.202.12]:58886 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758765AbcCEITu (ORCPT ); Sat, 5 Mar 2016 03:19:50 -0500 Date: Sat, 5 Mar 2016 00:19:30 -0800 From: "tip-bot for Steven Rostedt (Red Hat)" Message-ID: Cc: acme@redhat.com, akpm@linux-foundation.org, tglx@linutronix.de, rostedt@goodmis.org, linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com Reply-To: hpa@zytor.com, linux-kernel@vger.kernel.org, rostedt@goodmis.org, mingo@kernel.org, tglx@linutronix.de, acme@redhat.com, akpm@linux-foundation.org In-Reply-To: <20160209204237.188327674@goodmis.org> References: <20160209204237.188327674@goodmis.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools lib traceevent: Set int_array fields to NULL if freeing from error Git-Commit-ID: 9ec72eafee61f68cd57310a99db129ffb71302f3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9ec72eafee61f68cd57310a99db129ffb71302f3 Gitweb: http://git.kernel.org/tip/9ec72eafee61f68cd57310a99db129ffb71302f3 Author: Steven Rostedt (Red Hat) AuthorDate: Tue, 9 Feb 2016 15:40:16 -0500 Committer: Arnaldo Carvalho de Melo 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 Cc: Andrew Morton Link: http://lkml.kernel.org/r/20160209204237.188327674@goodmis.org Signed-off-by: Arnaldo Carvalho de Melo --- 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;