summaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2023-04-12 09:50:08 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-04-12 10:00:19 -0300
commit9fbde6c8002bce61acd0c2187cc41c43a7c99968 (patch)
treeb555d357fcb5f87ca89ef0a2c3f3468e409e3677 /tools/perf
parent313b4c1ccdb273f6733e8c44948f8c7141f592a4 (diff)
downloadlinux-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.c2
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);
}