commit | 7efd0813b7ec9fe844a4177059eeebae4575390a | [log] [tgz] |
---|---|---|
author | Namhyung Kim <namhyung@gmail.com> | Sun Sep 16 23:17:31 2012 +0900 |
committer | Chris E Ferron <chris.e.ferron@linux.intel.com> | Mon Sep 17 08:15:27 2012 -0700 |
tree | cb3eba8f0582c039e8189340c8062875cecc0ce5 | |
parent | bb194d09d18e7a7000b2ca743b943c74fb982e31 [diff] |
perf: Check return value of strdup The strdup() can return NULL so that the result should be checked. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
diff --git a/src/perf/perf.cpp b/src/perf/perf.cpp index c8ba7a8..35b4017 100644 --- a/src/perf/perf.cpp +++ b/src/perf/perf.cpp
@@ -145,6 +145,11 @@ if (name) free(name); name = strdup(event_name); + if (!name) { + fprintf(stderr, "failed to allocate event name\n"); + return; + } + char *c; c = strchr(name, ':');