Commit 00ae1127 authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

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: default avatarDavid Ahern <dsahern@gmail.com>
Acked-by: default avatarSteven 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 70e97278
...@@ -6228,15 +6228,20 @@ void pevent_ref(struct pevent *pevent) ...@@ -6228,15 +6228,20 @@ void pevent_ref(struct pevent *pevent)
pevent->ref_count++; 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) static void free_format_fields(struct format_field *field)
{ {
struct format_field *next; struct format_field *next;
while (field) { while (field) {
next = field->next; next = field->next;
free(field->type); pevent_free_format_field(field);
free(field->name);
free(field);
field = next; field = next;
} }
} }
......
...@@ -619,6 +619,7 @@ enum pevent_errno pevent_parse_format(struct pevent *pevent, ...@@ -619,6 +619,7 @@ enum pevent_errno pevent_parse_format(struct pevent *pevent,
const char *buf, const char *buf,
unsigned long size, const char *sys); unsigned long size, const char *sys);
void pevent_free_format(struct event_format *event); 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, void *pevent_get_field_raw(struct trace_seq *s, struct event_format *event,
const char *name, struct pevent_record *record, const char *name, struct pevent_record *record,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment