aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-03-23 00:00:10 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-03-23 00:00:10 -0400
commitd632824b6d9993a862a8c7b6b71745ea8ed24bee (patch)
tree48cae862cadfd2bd0dc93531ffd665fd9516977f
parentba55787926d00253ca4db3df5f5c5d5287037740 (diff)
parse-events: Handle failure of process op
If the process_op fails in event_read_print_args the failure will go unnoticed. Also do zero out the right arg on failed condition, since it may point back to the original arg and cause a double free. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/parse-events.c b/parse-events.c
index 31ea61e..aa4ea94 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -1419,6 +1419,8 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok)
1419 return type; 1419 return type;
1420 1420
1421out_free: 1421out_free:
1422 /* Top may point to itself */
1423 top->op.right = NULL;
1422 free_token(token); 1424 free_token(token);
1423 free_arg(arg); 1425 free_arg(arg);
1424 return EVENT_ERROR; 1426 return EVENT_ERROR;
@@ -2333,6 +2335,11 @@ static int event_read_print_args(struct event_format *event, struct print_arg **
2333 if (type == EVENT_OP) { 2335 if (type == EVENT_OP) {
2334 type = process_op(event, arg, &token); 2336 type = process_op(event, arg, &token);
2335 free_token(token); 2337 free_token(token);
2338 if (type == EVENT_ERROR) {
2339 *list = NULL;
2340 free_arg(arg);
2341 return -1;
2342 }
2336 list = &arg->next; 2343 list = &arg->next;
2337 continue; 2344 continue;
2338 } 2345 }