Fix memory leak in parse_action
Change-Id: I3ed1da5674ae0b4ac50c1925e4f63af7f1748483
diff --git a/init/init_parser.cpp b/init/init_parser.cpp
index af935d7..ff31093 100644
--- a/init/init_parser.cpp
+++ b/init/init_parser.cpp
@@ -946,7 +946,14 @@
for (i = 1; i < nargs; i++) {
if (!(i % 2)) {
if (strcmp(args[i], "&&")) {
+ struct listnode *node;
+ struct listnode *node2;
parse_error(state, "& is the only symbol allowed to concatenate actions\n");
+ list_for_each_safe(node, node2, &act->triggers) {
+ struct trigger *trigger = node_to_item(node, struct trigger, nlist);
+ free(trigger);
+ }
+ free(act);
return 0;
} else
continue;