lkml.org 
[lkml]   [2015]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v10 41/50] perf probe: Reset tev->args and tev->nargs when failure
Date
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


\
 
 \ /
  Last update: 2015-07-01 04:41    [W:0.245 / U:1.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site