log: remember to free output buffer when done
authorJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:57:52 +0000 (12:57 -0600)
committerJens Axboe <axboe@kernel.dk>
Fri, 7 Sep 2018 18:57:52 +0000 (12:57 -0600)
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 <axboe@kernel.dk>
backend.c
client.c
init.c

index 314d6e3..bb8bd13 100644 (file)
--- 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;
index 0f28cf6..b2fef2a 100644 (file)
--- 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 b13cee2..c235b05 100644 (file)
--- 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);