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:00:19 -0300 |
commit | 9fbde6c8002bce61acd0c2187cc41c43a7c99968 (patch) | |
tree | b555d357fcb5f87ca89ef0a2c3f3468e409e3677 /tools/perf | |
parent | 313b4c1ccdb273f6733e8c44948f8c7141f592a4 (diff) | |
download | linux-stable-9fbde6c8002bce61acd0c2187cc41c43a7c99968.tar.gz linux-stable-9fbde6c8002bce61acd0c2187cc41c43a7c99968.tar.bz2 linux-stable-9fbde6c8002bce61acd0c2187cc41c43a7c99968.zip |
perf env: 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/perf')
-rw-r--r-- | tools/perf/util/env.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c index 5b8cf6a421a4..ebf2e801c275 100644 --- a/tools/perf/util/env.c +++ b/tools/perf/util/env.c @@ -149,7 +149,7 @@ static void perf_env__purge_bpf(struct perf_env *env) node = rb_entry(next, struct bpf_prog_info_node, rb_node); next = rb_next(&node->rb_node); rb_erase(&node->rb_node, root); - free(node->info_linear); + zfree(&node->info_linear); free(node); } |