From: Hui Zhu Date: Fri, 7 Sep 2012 12:36:28 +0000 (-0400) Subject: Fix babeltrace-log uninitialized memory X-Git-Tag: v1.0.0-rc6~31 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=36741bea2b53007c29ac0391ee9086722e00653a;hp=2bdfa4cfc433d2c6e07d6474078bb896d1f3697a;ds=sidebyside Fix babeltrace-log uninitialized memory Got a crash with babeltrace-log. ../../../babeltrace/include/babeltrace/mmap-align.h:78 index=0, whence=0) at ../../../babeltrace/formats/ctf/ctf.c:623 at ../../../babeltrace/formats/ctf/ctf.c:576 <_IO_2_1_stdin_>) at ../../babeltrace/converter/babeltrace-log.c:233 ../../babeltrace/converter/babeltrace-log.c:342 This issue because pos is used before it init. This patch init it in function ctf_init_pos. Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index f43fe917..d4ff2a52 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -550,6 +550,7 @@ error: void ctf_init_pos(struct ctf_stream_pos *pos, int fd, int open_flags) { + memset(pos, 0, sizeof(*pos)); pos->fd = fd; if (fd >= 0) { pos->packet_cycles_index = g_array_new(FALSE, TRUE,