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 314d6e33f5b981c03f4fd727979d4e101bee8a7b..bb8bd13bd11f973e616fd3897483e27ec833cbc5 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 0f28cf6373535959f933c0ab8eddb8c495f256bc..b2fef2ad467baeb68ec43dcfad7439998d4a5b5d 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 b13cee26148fd4b9c1c232a53fb03313dbb3ecc0..c235b05e192584073f0792253a733fd16b59aabb 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);