summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2012-04-06 00:48:02 +0200
committerFrederic Weisbecker <fweisbec@gmail.com>2012-04-25 13:35:35 +0200
commita2525a0852d81b1cf1155d75d1e3db9682fee191 (patch)
treed203cae23682148bd6ff1a4d6740d9c11641ba47 /tools/lib
parent14ffde0e966efab6724e2de3ab470b78d4e01109 (diff)
parse-events: Let pevent_free() take a NULL pointer
The pevent_free() should ack like other free()s and allow a NULL pointer to be passed to it which makes error handling a bit easier for the users of pevent_free(). Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Arun Sharma <asharma@fb.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/traceevent/event-parse.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index cdb32c78d150..4d5092f67167 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -4960,13 +4960,20 @@ static void free_event(struct event_format *event)
*/
void pevent_free(struct pevent *pevent)
{
- struct cmdline_list *cmdlist = pevent->cmdlist, *cmdnext;
- struct func_list *funclist = pevent->funclist, *funcnext;
- struct printk_list *printklist = pevent->printklist, *printknext;
+ struct cmdline_list *cmdlist, *cmdnext;
+ struct func_list *funclist, *funcnext;
+ struct printk_list *printklist, *printknext;
struct pevent_function_handler *func_handler;
struct event_handler *handle;
int i;
+ if (!pevent)
+ return;
+
+ cmdlist = pevent->cmdlist;
+ funclist = pevent->funclist;
+ printklist = pevent->printklist;
+
pevent->ref_count--;
if (pevent->ref_count)
return;