From 86b06ede131de636cd9ee62ea79d37f86e75c257 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 20 Aug 2012 16:09:25 -0400 Subject: [PATCH] Fix: ensure mmap_base_offset is zeroed on initialization Signed-off-by: Mathieu Desnoyers --- formats/ctf/ctf.c | 9 --------- formats/ctf/types/float.c | 1 + 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 272e8c45..a2403a77 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -551,15 +551,6 @@ error: void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) { pos->fd = fd; - pos->mmap_offset = 0; - pos->packet_size = 0; - pos->content_size = 0; - pos->content_size_loc = NULL; - pos->base_mma = NULL; - pos->offset = 0; - pos->dummy = false; - pos->cur_index = 0; - pos->packet_real_index = NULL; if (fd >= 0) { pos->packet_cycles_index = g_array_new(FALSE, TRUE, sizeof(struct packet_index)); diff --git a/formats/ctf/types/float.c b/formats/ctf/types/float.c index 7a7c323a..9ad4e602 100644 --- a/formats/ctf/types/float.c +++ b/formats/ctf/types/float.c @@ -163,6 +163,7 @@ int ctf_float_read(struct stream_pos *ppos, struct definition *definition) return -EINVAL; } tmpfloat = container_of(tmpdef, struct definition_float, p); + memset(&destp, 0, sizeof(destp)); ctf_init_pos(&destp, -1, O_RDWR); mmap_align_set_addr(&mma, (char *) u.bits); destp.base_mma = &mma; -- 2.34.1