diff options
author | David Ahern <dsahern@gmail.com> | 2015-03-19 12:36:21 -0600 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-03-24 15:21:37 -0400 |
commit | a8bdc386a08ea324e09c18a757e4b20ab40b4d6a (patch) | |
tree | 8631dd289429e4c6002ee4ce9261dca328d0a4eb | |
parent | b5675fd259d9d5f81d73915f158e9db08baf942d (diff) | |
download | trace-cmd-a8bdc386a08ea324e09c18a757e4b20ab40b4d6a.tar.gz |
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 <dsahern@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
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 <acme@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | event-parse.c | 11 | ||||
-rw-r--r-- | event-parse.h | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/event-parse.c b/event-parse.c index 070d97dc..aff74371 100644 --- a/event-parse.c +++ b/event-parse.c @@ -6330,15 +6330,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/event-parse.h b/event-parse.h index dd6378a4..37e93cc5 100644 --- a/event-parse.h +++ b/event-parse.h @@ -610,6 +610,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, |