diff options
author | David Ahern <dsahern@gmail.com> | 2015-03-19 14:36:21 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-03-21 13:53:38 -0400 |
commit | 00ae1127a03d20f5ef89f3c1fe7d4720270fc2a5 (patch) | |
tree | fb7cabd1c218d8235e9e88060fd36865fd25e61f /tools/lib | |
parent | 70e972788888315851a5c1b4982efbcafcd03b5b (diff) |
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>
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/traceevent/event-parse.c | 11 | ||||
-rw-r--r-- | 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 afe20ed9fac8..d7c37a7d9255 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) | |||
6228 | pevent->ref_count++; | 6228 | pevent->ref_count++; |
6229 | } | 6229 | } |
6230 | 6230 | ||
6231 | void pevent_free_format_field(struct format_field *field) | ||
6232 | { | ||
6233 | free(field->type); | ||
6234 | free(field->name); | ||
6235 | free(field); | ||
6236 | } | ||
6237 | |||
6231 | static void free_format_fields(struct format_field *field) | 6238 | static void free_format_fields(struct format_field *field) |
6232 | { | 6239 | { |
6233 | struct format_field *next; | 6240 | struct format_field *next; |
6234 | 6241 | ||
6235 | while (field) { | 6242 | while (field) { |
6236 | next = field->next; | 6243 | next = field->next; |
6237 | free(field->type); | 6244 | pevent_free_format_field(field); |
6238 | free(field->name); | ||
6239 | free(field); | ||
6240 | field = next; | 6245 | field = next; |
6241 | } | 6246 | } |
6242 | } | 6247 | } |
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index 5b4efc062320..6abda54d76f2 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, | |||
619 | const char *buf, | 619 | const char *buf, |
620 | unsigned long size, const char *sys); | 620 | unsigned long size, const char *sys); |
621 | void pevent_free_format(struct event_format *event); | 621 | void pevent_free_format(struct event_format *event); |
622 | void pevent_free_format_field(struct format_field *field); | ||
622 | 623 | ||
623 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, | 624 | void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event, |
624 | const char *name, struct pevent_record *record, | 625 | const char *name, struct pevent_record *record, |