aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2012-09-25 08:25:19 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-09-25 08:53:53 -0400
commitf1b2256d66fe8d613b9afcc1c16079362f9fc05c (patch)
treee1d09be0668b8f42d7a15ba030692d853ce1aa36
parentaf9da88f14cbe6882b13492b59b3363682427b4d (diff)
tools lib traceevent: Fix error path on pevent_parse_event
If __pevent_parse_format() succeeded but add_event() failed, 'ret' didn't have a proper error code. Set it to PEVENT_ERRNO__MEM_ALLOC_FAILED. In addition, at that point 'event' also has fields and format information and they all need to be freed. Call pevent_free_format() to handle it. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1348575919-4954-1-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/lib/traceevent/event-parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 17c922145e88..47264b4652b9 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5044,8 +5044,10 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf,
5044 /* Add pevent to event so that it can be referenced */ 5044 /* Add pevent to event so that it can be referenced */
5045 event->pevent = pevent; 5045 event->pevent = pevent;
5046 5046
5047 if (add_event(pevent, event)) 5047 if (add_event(pevent, event)) {
5048 ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
5048 goto event_add_failed; 5049 goto event_add_failed;
5050 }
5049 5051
5050#define PRINT_ARGS 0 5052#define PRINT_ARGS 0
5051 if (PRINT_ARGS && event->print_fmt.args) 5053 if (PRINT_ARGS && event->print_fmt.args)
@@ -5054,9 +5056,7 @@ enum pevent_errno pevent_parse_event(struct pevent *pevent, const char *buf,
5054 return 0; 5056 return 0;
5055 5057
5056event_add_failed: 5058event_add_failed:
5057 free(event->system); 5059 pevent_free_format(event);
5058 free(event->name);
5059 free(event);
5060 return ret; 5060 return ret;
5061} 5061}
5062 5062