From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752747AbbCVKRp (ORCPT ); Sun, 22 Mar 2015 06:17:45 -0400 Received: from terminus.zytor.com ([198.137.202.10]:57397 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751727AbbCVKRn (ORCPT ); Sun, 22 Mar 2015 06:17:43 -0400 Date: Sun, 22 Mar 2015 03:17:20 -0700 From: tip-bot for David Ahern Message-ID: Cc: tglx@linutronix.de, rostedt@goodmis.org, linux-kernel@vger.kernel.org, hpa@zytor.com, dsahern@gmail.com, acme@redhat.com, mingo@kernel.org Reply-To: mingo@kernel.org, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, tglx@linutronix.de, rostedt@goodmis.org, linux-kernel@vger.kernel.org In-Reply-To: <1426790181-19118-1-git-send-email-dsahern@gmail.com> References: <1426790181-19118-1-git-send-email-dsahern@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools lib traceevent: Add destructor for format_field Git-Commit-ID: 00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5 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: 00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5 Gitweb: http://git.kernel.org/tip/00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5 Author: David Ahern AuthorDate: Thu, 19 Mar 2015 12:36:21 -0600 Committer: Arnaldo Carvalho de Melo CommitDate: Sat, 21 Mar 2015 14:53:38 -0300 tools lib traceevent: Add destructor for format_field Move the calls that frees the resources allocated for a struct format_field to a separate routine. Signed-off-by: David Ahern Acked-by: Steven Rostedt Link: http://lkml.kernel.org/r/1426790181-19118-1-git-send-email-dsahern@gmail.com [ Split this part from a larger patch, added pevent_ prefix as requested by Steven ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 11 ++++++++--- tools/lib/traceevent/event-parse.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index afe20ed..d7c37a7 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -6228,15 +6228,20 @@ void pevent_ref(struct pevent *pevent) pevent->ref_count++; } +void pevent_free_format_field(struct format_field *field) +{ + free(field->type); + free(field->name); + free(field); +} + static void free_format_fields(struct format_field *field) { struct format_field *next; while (field) { next = field->next; - free(field->type); - free(field->name); - free(field); + pevent_free_format_field(field); field = next; } } diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 5b4efc0..6abda54 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h @@ -619,6 +619,7 @@ enum pevent_errno pevent_parse_format(struct pevent *pevent, const char *buf, unsigned long size, const char *sys); void pevent_free_format(struct event_format *event); +void pevent_free_format_field(struct format_field *field); void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, const char *name, struct pevent_record *record,