Messages in this thread Patch in this message | | | From | Rickard Strandqvist <> | Subject | [PATCH] tools: perf: builtin-trace.c: Cleaning up inconsistent NULL checks | Date | Thu, 22 May 2014 23:56:56 +0200 |
| |
Cleaning up inconsistent NULL checks. There is otherwise a risk of a possible null pointer dereference.
Was largely found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> --- tools/perf/builtin-trace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index f954c26..130063a 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -1146,8 +1146,10 @@ static struct thread_trace *thread_trace__new(void) { struct thread_trace *ttrace = zalloc(sizeof(struct thread_trace)); - if (ttrace) - ttrace->paths.max = -1; + if (!ttrace) + return NULL; + + ttrace->paths.max = -1; ttrace->syscall_stats = intlist__new(NULL); -- 1.7.10.4
| |