Commit-ID:  91dfa49bdd8ef9600d850ef68ec892eb70824e3d
Gitweb:     http://git.kernel.org/tip/91dfa49bdd8ef9600d850ef68ec892eb70824e3d
Author:     Namhyung Kim <namhy...@kernel.org>
AuthorDate: Thu, 12 Dec 2013 16:36:07 +0900
Committer:  Arnaldo Carvalho de Melo <a...@redhat.com>
CommitDate: Fri, 13 Dec 2013 10:30:21 -0300

tools lib traceevent: Get rid of malloc_or_die() in read_token()

Signed-off-by: Namhyung Kim <namhy...@kernel.org>
Reviewed-by: Steven Rostedt <rost...@goodmis.org>
Cc: Frederic Weisbecker <fweis...@gmail.com>
Cc: Ingo Molnar <mi...@kernel.org>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Namhyung Kim <namhyung....@lge.com>
Cc: Peter Zijlstra <a.p.zijls...@chello.nl>
Cc: Steven Rostedt <rost...@goodmis.org>
Link: 
http://lkml.kernel.org/r/1386833777-3790-5-git-send-email-namhy...@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <a...@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/parse-filter.c 
b/tools/lib/traceevent/parse-filter.c
index ab9cefe..246ee81 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -109,7 +109,11 @@ static enum event_type read_token(char **tok)
            (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) &&
            pevent_peek_char() == '~') {
                /* append it */
-               *tok = malloc_or_die(3);
+               *tok = malloc(3);
+               if (*tok == NULL) {
+                       free_token(token);
+                       return EVENT_ERROR;
+               }
                sprintf(*tok, "%c%c", *token, '~');
                free_token(token);
                /* Now remove the '~' from the buffer */
@@ -1123,6 +1127,8 @@ process_filter(struct event_format *event, struct 
filter_arg **parg,
                        break;
                case EVENT_NONE:
                        break;
+               case EVENT_ERROR:
+                       goto fail_alloc;
                default:
                        goto fail_print;
                }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to