perf inject: 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 f00e5892
...@@ -1311,10 +1311,10 @@ static void guest_session__exit(struct guest_session *gs) ...@@ -1311,10 +1311,10 @@ static void guest_session__exit(struct guest_session *gs)
if (gs->tmp_fd >= 0) if (gs->tmp_fd >= 0)
close(gs->tmp_fd); close(gs->tmp_fd);
unlink(gs->tmp_file_name); unlink(gs->tmp_file_name);
free(gs->tmp_file_name); zfree(&gs->tmp_file_name);
} }
free(gs->vcpu); zfree(&gs->vcpu);
free(gs->perf_data_file); zfree(&gs->perf_data_file);
} }
static void get_tsc_conv(struct perf_tsc_conversion *tc, struct perf_record_time_conv *time_conv) static void get_tsc_conv(struct perf_tsc_conversion *tc, struct perf_record_time_conv *time_conv)
......
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