perf tools: Fix possible double free on error
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 25 Jan 2013 09:57:08 +0000 (10:57 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 30 Jan 2013 13:37:41 +0000 (10:37 -0300)
Can only be triggered via CROSS_COMPILE env var.

Detected by cppcheck.

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/36736865.AIlztKhDqN@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/arch/common.c

index 3e975cb6232eb97b2d14a9d4f069653727a6d649..aacef07ebf31525227b372e6c40e9a3039c5d580 100644 (file)
@@ -155,6 +155,7 @@ static int perf_session_env__lookup_binutils_path(struct perf_session_env *env,
                if (lookup_path(buf))
                        goto out;
                free(buf);
+               buf = NULL;
        }
 
        if (!strcmp(arch, "arm"))