projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
313b4c1
)
perf env: 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:00:19 +0000
(10:00 -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/env.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/env.c
b/tools/perf/util/env.c
index 5b8cf6a421a4951df882cdd9b119c70bf1407635..ebf2e801c275f97455fcb5f5d5d943fcc823d138 100644
(file)
--- 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);
}