From 90d2d53f67f45d7501bc5473518a07bf43beba84 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sat, 11 Jun 2016 21:38:51 -0600 Subject: [PATCH] iolog: allocate 'cur_log's out of shared pool Different process, so we need to ensure we can write to them properly. Signed-off-by: Jens Axboe --- iolog.c | 1 + stat.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/iolog.c b/iolog.c index 93915079..4ecf39ab 100644 --- a/iolog.c +++ b/iolog.c @@ -988,6 +988,7 @@ void flush_log(struct io_log *log, int do_append) cur_log = flist_first_entry(&log->io_logs, struct io_logs, list); flist_del_init(&cur_log->list); flush_samples(f, cur_log->log, cur_log->nr_samples * log_entry_sz(log)); + sfree(cur_log); } fclose(f); diff --git a/stat.c b/stat.c index a8ccd9ab..26d8d537 100644 --- a/stat.c +++ b/stat.c @@ -16,6 +16,7 @@ #include "lib/pow2.h" #include "lib/output_buffer.h" #include "helper_thread.h" +#include "smalloc.h" struct fio_mutex *stat_mutex; @@ -1877,7 +1878,7 @@ static struct io_logs *get_new_log(struct io_log *iolog) new_size = new_samples * log_entry_sz(iolog); - cur_log = malloc(sizeof(*cur_log)); + cur_log = smalloc(sizeof(*cur_log)); if (cur_log) { INIT_FLIST_HEAD(&cur_log->list); cur_log->log = malloc(new_size); @@ -1888,7 +1889,7 @@ static struct io_logs *get_new_log(struct io_log *iolog) iolog->cur_log_max = new_samples; return cur_log; } - free(cur_log); + sfree(cur_log); } return NULL; -- 2.25.1