iolog: fix 'cur_log' leaks
authorJens Axboe <axboe@fb.com>
Sun, 12 Jun 2016 03:41:13 +0000 (21:41 -0600)
committerJens Axboe <axboe@fb.com>
Sun, 12 Jun 2016 03:41:13 +0000 (21:41 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
iolog.c

diff --git a/iolog.c b/iolog.c
index 4ecf39abe914f4afdfda4b181452a9ba775edf5a..ff521df4719818e2ecf368ef021e1763be5a1f3b 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -645,6 +645,7 @@ void free_log(struct io_log *log)
                cur_log = flist_first_entry(&log->io_logs, struct io_logs, list);
                flist_del_init(&cur_log->list);
                free(cur_log->log);
+               sfree(cur_log);
        }
 
        if (log->pending) {
@@ -1227,9 +1228,7 @@ static int iolog_flush(struct io_log *log)
                data->samples = cur_log->log;
                data->nr_samples = cur_log->nr_samples;
 
-               cur_log->nr_samples = 0;
-               cur_log->max_samples = 0;
-               cur_log->log = NULL;
+               sfree(cur_log);
 
                gz_work(data);
        }