Don't leak f_out file desciptor if specified more than once
authorJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:39:46 +0000 (11:39 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 11 Apr 2014 17:39:46 +0000 (11:39 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
init.c

diff --git a/init.c b/init.c
index a0ec914..35fbdf1 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1719,6 +1719,9 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        write_bw_log = 1;
                        break;
                case 'o':
+                       if (f_out)
+                               fclose(f_out);
+
                        f_out = fopen(optarg, "w+");
                        if (!f_out) {
                                perror("fopen output");