trace-cmd: Fix last_timestamp logic to handle multiple files

The last_timestamp logic to check the integrity of the timestamps in the
ring buffer was done globally, but would break if multiple files were being
included where the data files had different number of CPUs. That's because
the last_timestamp array was recreated for each passed in data file and the
size of the number of CPUs for each file.

Not only was the last_timestamp broken if there were different number of
CPUs, but it was also leaking memory.

Link: https://lore.kernel.org/linux-trace-devel/20210210164543.5ecd9dbd@gandalf.local.home

Fixes: 8cf601567 ("trace-cmd: Add --ts-check option to report")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 file changed