projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c77ceb2
)
perf evlist: Use zfree() to reduce chances of use after free
author
Arnaldo Carvalho de Melo
<acme@redhat.com>
Wed, 12 Apr 2023 12:50:08 +0000
(09:50 -0300)
committer
Arnaldo Carvalho de Melo
<acme@redhat.com>
Wed, 12 Apr 2023 13:11:51 +0000
(10:11 -0300)
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>
tools/perf/util/evlist.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/evlist.c
b/tools/perf/util/evlist.c
index df6af38ca22e081b31bf26218add16a0200fa9a2..2260e27adf44c579eb50c9fa60440e925038ee04 100644
(file)
--- 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);
}