The sfree() in free_clat_prio_stats() itself handles NULL, so the function
already handles a struct thread_stat without any per priority stats.
(Per priority stats are disabled on threads/thread_stats that we know will
never be able to contain more than a single priority.)
However, if malloc() in e.g. gen_mixed_ddir_stats_from_ts() or
__show_run_stats() failed to allocate memory, free_clat_prio_stats() will
be supplied a NULL pointer.
Fix free_clat_prio_stats() to handle a NULL pointer gracefully.
Fixes:
4ad856497c0b ("stat: add a new function to allocate a clat_prio_stat array")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Link: https://lore.kernel.org/r/20220204001741.34419-1-Niklas.Cassel@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
{
enum fio_ddir ddir;
+ if (!ts)
+ return;
+
for (ddir = 0; ddir < DDIR_RWDIR_CNT; ddir++) {
sfree(ts->clat_prio[ddir]);
ts->clat_prio[ddir] = NULL;