diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 09:50:08 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 10:11:51 -0300 |
commit | 2bfc8134f95852bd8b0190641c2d2b059cb1c8cc (patch) | |
tree | 05d25a9feedb047c2801340a26aec373481a6a90 /tools | |
parent | c77ceb2eb03eefd92e6b84a509ecec1db8d97858 (diff) | |
download | linux-stable-2bfc8134f95852bd8b0190641c2d2b059cb1c8cc.tar.gz linux-stable-2bfc8134f95852bd8b0190641c2d2b059cb1c8cc.tar.bz2 linux-stable-2bfc8134f95852bd8b0190641c2d2b059cb1c8cc.zip |
perf evlist: Use zfree() to reduce chances of use after free
Do defensive programming by using zfree() to initialize freed pointers
to NULL, so that eventual use after free result in a NULL pointer deref
instead of more subtle behaviour.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/evlist.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index df6af38ca22e..2260e27adf44 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -2325,7 +2325,7 @@ int evlist__parse_event_enable_time(struct evlist *evlist, struct record_opts *o close_timerfd: close(eet->timerfd); free_eet_times: - free(eet->times); + zfree(&eet->times); free_eet: free(eet); return err; @@ -2407,7 +2407,7 @@ void event_enable_timer__exit(struct event_enable_timer **ep) { if (!ep || !*ep) return; - free((*ep)->times); + zfree(&(*ep)->times); zfree(ep); } |