Fix crash on loading unknown IO engine with --ioengine
authorJens Axboe <axboe@fb.com>
Mon, 9 Jun 2014 19:54:22 +0000 (13:54 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 9 Jun 2014 19:54:22 +0000 (13:54 -0600)
We don't clean up properly for a command line job when this happens.

Signed-off-by: Jens Axboe <axboe@fb.com>
init.c

diff --git a/init.c b/init.c
index a546861..74a02e0 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1884,8 +1884,14 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                                        continue;
 
                                td = get_new_job(global, &def_thread, 1);
-                               if (!td || ioengine_load(td))
-                                       goto out_free;
+                               if (!td || ioengine_load(td)) {
+                                       if (td) {
+                                               put_job(td);
+                                               td = NULL;
+                                       }
+                                       do_exit++;
+                                       break;
+                               }
                                fio_options_set_ioengine_opts(l_opts, td);
                        }
 
@@ -1906,8 +1912,14 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
 
                        if (!ret && !strcmp(opt, "ioengine")) {
                                free_ioengine(td);
-                               if (ioengine_load(td))
-                                       goto out_free;
+                               if (ioengine_load(td)) {
+                                       if (td) {
+                                               put_job(td);
+                                               td = NULL;
+                                       }
+                                       do_exit++;
+                                       break;
+                               }
                                fio_options_set_ioengine_opts(l_opts, td);
                        }
                        break;