From: Steven Rostedt Date: Thu, 5 Apr 2012 22:48:02 +0000 (+0200) Subject: parse-events: Let pevent_free() take a NULL pointer X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a2525a0852d81b1cf1155d75d1e3db9682fee191;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Steven Rostedt Cc: Borislav Petkov Cc: Jiri Olsa Cc: Arun Sharma Cc: Namhyung Kim Signed-off-by: Frederic Weisbecker --- 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;