[PATCH 07/11] parse-events: Do not call add_event() again if allocation failed

From: Namhyung Kim
Date: Mon Apr 23 2012 - 01:00:24 EST


When memory allocation for the field name is failed, do not
goto event_failed since we added the event already.

Signed-off-by: Namhyung Kim <namhyung.kim@xxxxxxx>
---
parse-events.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/parse-events.c b/parse-events.c
index 3b39923..52cf331 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -4637,7 +4637,8 @@ int pevent_parse_event(struct pevent *pevent,
arg->field.name = strdup(field->name);
if (!arg->field.name) {
do_warning("failed to allocate field name");
- goto event_failed;
+ event->flags |= EVENT_FL_FAILED;
+ return -1;
}
arg->field.field = field;
}
--
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/