diff options
author | Masami Hiramatsu <[email protected]> | 2011-08-11 20:02:29 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2011-08-12 09:21:15 -0300 |
commit | 8afa2a707d3d1320df5d35966729ac5262da737d (patch) | |
tree | 92126a1e215cb43bd1f29db65e33f9ad3c5fd5e9 | |
parent | e9b52ef2228cd0bed7a4465c693a39489e2c338d (diff) |
perf probe: Fix a memory leak for scopes array
Fix a memory leak for scopes array when it finds a variable in the
global scope.
Reviewed-by: Pekka Enberg <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/20110811110229.19900.63019.stgit@fedora15
Signed-off-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/probe-finder.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 3e44a3e36519..573c72363223 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -660,6 +660,7 @@ static int find_variable(Dwarf_Die *sp_die, struct probe_finder *pf) else { /* Search upper class */ nscopes = dwarf_getscopes_die(sp_die, &scopes); + ret = -ENOENT; while (nscopes-- > 1) { pr_debug("Searching variables in %s\n", dwarf_diename(&scopes[nscopes])); @@ -668,14 +669,12 @@ static int find_variable(Dwarf_Die *sp_die, struct probe_finder *pf) pf->pvar->var, 0, &vr_die)) { ret = convert_variable(&vr_die, pf); - goto found; + break; } } if (scopes) free(scopes); - ret = -ENOENT; } -found: if (ret < 0) pr_warning("Failed to find '%s' in this function.\n", pf->pvar->var); |