From d5bb0a8902b787718e7027be85573773781f0898 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 7 Sep 2018 12:57:52 -0600 Subject: [PATCH] log: remember to free output buffer when done We need to ensure we call buf_output_free() after using the temp storage, otherwise we leaked the memory that we allocated while filling the buffer. Signed-off-by: Jens Axboe --- backend.c | 1 + client.c | 1 + init.c | 1 + 3 files changed, 3 insertions(+) diff --git a/backend.c b/backend.c index 314d6e33..bb8bd13b 100644 --- a/backend.c +++ b/backend.c @@ -2228,6 +2228,7 @@ static void run_threads(struct sk_out *sk_out) } __log_buf(&out, "\n"); log_info_buf(out.buf, out.buflen); + buf_output_free(&out); } todo = thread_number; diff --git a/client.c b/client.c index 0f28cf63..b2fef2ad 100644 --- a/client.c +++ b/client.c @@ -1154,6 +1154,7 @@ static void handle_text(struct fio_client *client, struct fio_net_cmd *cmd) __log_buf(&out, "<%s> ", name); __log_buf(&out, "%s", buf); log_info_buf(out.buf, out.buflen); + buf_output_free(&out); client->skip_newline = strchr(buf, '\n') == NULL; } diff --git a/init.c b/init.c index b13cee26..c235b05e 100644 --- a/init.c +++ b/init.c @@ -1708,6 +1708,7 @@ static int add_job(struct thread_data *td, const char *jobname, int job_add_num, __log_buf(&out, "ioengine=%s, iodepth=%u\n", td->io_ops->name, o->iodepth); log_info_buf(out.buf, out.buflen); + buf_output_free(&out); free(c1); free(c2); -- 2.25.1