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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 313b4c1c
...@@ -149,7 +149,7 @@ static void perf_env__purge_bpf(struct perf_env *env) ...@@ -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); node = rb_entry(next, struct bpf_prog_info_node, rb_node);
next = rb_next(&node->rb_node); next = rb_next(&node->rb_node);
rb_erase(&node->rb_node, root); rb_erase(&node->rb_node, root);
free(node->info_linear); zfree(&node->info_linear);
free(node); free(node);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment