aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFederico Vaga <federico.vaga@vaga.pv.it>2017-04-23 12:22:56 +0200
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-26 10:49:42 -0400
commitc8bc47393693d6d6641bfcf9343b1a9adf83be2b (patch)
tree192daaf3d2f056d874b376068f89871467a088b6
parent53e9b788d537ad9735c3186d93f14d1efbf62f4d (diff)
downloadtrace-cmd-c8bc47393693d6d6641bfcf9343b1a9adf83be2b.tar.gz
trace-cmd:read: BUG initialize input_files item to zero
On allocation the data structure was not initialized. Later on some attribute of this structure are used (e.g. tsoffset) assuming that the default value is zero, but it is not always true. Link: http://lkml.kernel.org/r/20170423102258.21609-4-federico.vaga@vaga.pv.it Signed-off-by: Federico Vaga <federico.vaga@vaga.pv.it> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r--trace-read.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/trace-read.c b/trace-read.c
index c8a5b59d..2d48646e 100644
--- a/trace-read.c
+++ b/trace-read.c
@@ -294,6 +294,7 @@ static void add_input(const char *file)
item = malloc(sizeof(*item));
if (!item)
die("Failed to allocate for %s", file);
+ memset(item, 0, sizeof(*item));
item->file = file;
list_add_tail(&item->list, &input_files);
last_input_file = item;