perf genelf: 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 2bfc8134
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
* @author Philippe Elie * @author Philippe Elie
*/ */
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/zalloc.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <getopt.h> #include <getopt.h>
...@@ -90,7 +91,7 @@ buffer_ext_init(struct buffer_ext *be) ...@@ -90,7 +91,7 @@ buffer_ext_init(struct buffer_ext *be)
static void static void
buffer_ext_exit(struct buffer_ext *be) buffer_ext_exit(struct buffer_ext *be)
{ {
free(be->data); zfree(&be->data);
} }
static inline size_t static inline size_t
......
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