perf header: Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms...
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Fri, 25 Jan 2013 10:21:39 +0000 (11:21 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 30 Jan 2013 13:40:18 +0000 (10:40 -0300)
cppcheck reported:
[util/header.c:316]: (error) Memory leak: filename
[util/header.c:316]: (error) Memory leak: linkname

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

index e17a8fe..7b24cf3 100644 (file)
@@ -313,7 +313,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir,
        if (is_kallsyms) {
                if (symbol_conf.kptr_restrict) {
                        pr_debug("Not caching a kptr_restrict'ed /proc/kallsyms\n");
-                       return 0;
+                       err = 0;
+                       goto out_free;
                }
                realname = (char *) name;
        } else