When failure occures in add_probe_trace_event(), to avoid potential dangling pointer and memory leak, resource attached to 'struct probe_trace_event' should be cleared.
Signed-off-by: Wang Nan <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Zefan Li <[email protected]> Cc: [email protected] --- tools/perf/util/probe-finder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index bd8f03d..e9e37ca 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1235,6 +1235,8 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) end: free(args); + if (ret) + clear_probe_trace_event(tev); return ret; } -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

