Don't leak memory if profile option is given twice
[fio.git] / init.c
diff --git a/init.c b/init.c
index 11876b9a98a493114398df5d58f5042bf7f42ef5..a0ec914130934ba52626aad25f2b60b15c93c4a3 100644 (file)
--- a/init.c
+++ b/init.c
@@ -1828,6 +1828,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
                        break;
                        }
                case 'p':
+                       if (exec_profile)
+                               free(exec_profile);
                        exec_profile = strdup(optarg);
                        break;
                case FIO_GETOPT_JOB: {
@@ -1985,6 +1987,8 @@ int parse_cmd_line(int argc, char *argv[], int client_type)
 
        if (is_backend && backend)
                return fio_start_server(pid_file);
+       else if (pid_file)
+               free(pid_file);
 
        if (td) {
                if (!ret)
@@ -2033,7 +2037,7 @@ int parse_options(int argc, char *argv[])
 
        if (job_files > 0) {
                for (i = 0; i < job_files; i++) {
-                       if (fill_def_thread())
+                       if (i && fill_def_thread())
                                return 1;
                        if (nr_clients) {
                                if (fio_clients_send_ini(ini_file[i]))