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_strandqv...@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

--
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