Fixes valgrind complaint: =3118== Syscall param write(buf) points to uninitialised byte(s) ==3118== at 0x4E3F5B0: __write_nocancel (in /lib64/libpthread-2.14.90.so) ==3118== by 0x42F0EB: process_synthesized_event (builtin-record.c:89) ==3118== by 0x44E81C: perf_event__synthesize_mmap_events (event.c:230) ==3118== by 0x44F27C: perf_event__synthesize_threads (event.c:307) ==3118== by 0x42FEEA: cmd_record (builtin-record.c:530) ==3118== by 0x419D22: run_builtin (perf.c:319) ==3118== by 0x4195A2: main (perf.c:376)
Signed-off-by: David Ahern <dsah...@gmail.com> Cc: Ingo Molnar <mi...@kernel.org> Cc: Frederic Weisbecker <fweis...@gmail.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Jiri Olsa <jo...@redhat.com> Cc: Namhyung Kim <namhy...@kernel.org> --- tools/perf/util/event.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 5cd13d7..556b999 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -316,11 +316,11 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, union perf_event *comm_event, *mmap_event; int err = -1, thread, j; - comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); + comm_event = zalloc(sizeof(comm_event->comm) + machine->id_hdr_size); if (comm_event == NULL) goto out; - mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); + mmap_event = zalloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); if (mmap_event == NULL) goto out_free_comm; @@ -375,11 +375,11 @@ int perf_event__synthesize_threads(struct perf_tool *tool, union perf_event *comm_event, *mmap_event; int err = -1; - comm_event = malloc(sizeof(comm_event->comm) + machine->id_hdr_size); + comm_event = zalloc(sizeof(comm_event->comm) + machine->id_hdr_size); if (comm_event == NULL) goto out; - mmap_event = malloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); + mmap_event = zalloc(sizeof(mmap_event->mmap) + machine->id_hdr_size); if (mmap_event == NULL) goto out_free_comm; -- 1.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/