tools lib traceevent: Check result of malloc() during reading token
authorNamhyung Kim <namhyung.kim@lge.com>
Mon, 23 Apr 2012 04:58:36 +0000 (13:58 +0900)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 4 Jul 2012 04:40:31 +0000 (13:40 +0900)
The malloc can fail so the return value should be checked.  For now,
just use malloc_or_die().

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/1335157118-14658-10-git-send-email-namhyung.kim@lge.com
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/lib/traceevent/parse-filter.c

index 80d872a81f26db44b6fa38f3b35c289757eed85a..d54c2b4dbd9f1d6a95b81e587b05ae96eae48f5b 100644 (file)
@@ -96,7 +96,7 @@ static enum event_type read_token(char **tok)
            (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) &&
            pevent_peek_char() == '~') {
                /* append it */
-               *tok = malloc(3);
+               *tok = malloc_or_die(3);
                sprintf(*tok, "%c%c", *token, '~');
                free_token(token);
                /* Now remove the '~' from the buffer */