Fix segfault is bool option is used on command line and fails parsing
authorJens Axboe <axboe@kernel.dk>
Thu, 23 May 2013 17:54:43 +0000 (19:54 +0200)
committerJens Axboe <axboe@kernel.dk>
Thu, 23 May 2013 17:54:43 +0000 (19:54 +0200)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
init.c

diff --git a/init.c b/init.c
index 7246bd83c268dacac75c6de94027227bb1e7fb72..0cc6a520b15269c177ff1fa7ab01a4fddc2ac038 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1726,8 +1726,13 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        }
 
                        ret = fio_cmd_option_parse(td, opt, val);
-                       if (ret)
+                       if (ret) {
+                               if (td) {
+                                       put_job(td);
+                                       td = NULL;
+                               }
                                do_exit++;
+                       }
 
                        if (!ret && !strcmp(opt, "ioengine")) {
                                free_ioengine(td);