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 a0ec914130934ba52626aad25f2b60b15c93c4a3..35fbdf15365b3661b4dea465b2ae978be096cb59 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");