| From | Wang Nan <> | Subject | [RFC PATCH v10 41/50] perf probe: Reset tev->args and tev->nargs when failure | Date | Wed, 1 Jul 2015 02:14:29 +0000 |
| |
When failure occures in add_probe_trace_event(), tev->args is incomplete. Since information in tev may be used in further, this patch frees the allocated memory and set it to NULL to avoid dangling pointer.
Signed-off-by: Wang Nan <wangnan0@huawei.com> --- tools/perf/util/probe-finder.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 2da65a7..f533d19 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c @@ -1243,6 +1243,10 @@ static int add_probe_trace_event(Dwarf_Die *sc_die, struct probe_finder *pf) end: free(args); + if (ret) { + tev->nargs = 0; + zfree(&tev->args); + } return ret; } -- 1.8.3.4
|