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>
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 @@
return type;
out_free:
+ /* Top may point to itself */
+ top->op.right = NULL;
free_token(token);
free_arg(arg);
return EVENT_ERROR;
@@ -2333,6 +2335,11 @@
if (type == EVENT_OP) {
type = process_op(event, arg, &token);
free_token(token);
+ if (type == EVENT_ERROR) {
+ *list = NULL;
+ free_arg(arg);
+ return -1;
+ }
list = &arg->next;
continue;
}