Skip to contentSkip to conversation

Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms\n" case

PATCH In review Thomas Jarosch 1 participant 2 messages Jan 25, 2013 – Jan 31, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms\n" case

cppcheck reported:
[util/header.c:316]: (error) Memory leak: filename [util/header.c:316]: (error) Memory leak: linkname

---
 tools/perf/util/header.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/header.c +2 -1
index e17a8fe..7b24cf3 100644
@@ -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
Signature · 1 line
1.7.11.7
#1 lore raw

[tip:perf/core] perf header: Fix memory leak for the " Not caching a kptr_restrict'ed /proc/kallsyms" case

Commit-ID:  fdae6373910c10e27b8ae07e11e821b183d0bba5
Gitweb:     http://git.kernel.org/tip/fdae6373910c10e27b8ae07e11e821b183d0bba5
Author:     Thomas Jarosch <[email protected]>
AuthorDate: Fri, 25 Jan 2013 11:21:39 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 30 Jan 2013 10:40:18 -0300

perf header: Fix memory leak for the "Not caching a kptr_restrict'ed /proc/kallsyms" case

cppcheck reported:
[util/header.c:316]: (error) Memory leak: filename [util/header.c:316]: (error) Memory leak: linkname

---
 tools/perf/util/header.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/header.c +2 -1
index e17a8fe..7b24cf3 100644
@@ -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