gfio: fix error handling in send_job_files()
authorJens Axboe <axboe@kernel.dk>
Thu, 1 Mar 2012 07:01:52 +0000 (08:01 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Mar 2012 07:01:52 +0000 (08:01 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gfio.c

diff --git a/gfio.c b/gfio.c
index b14eed314948175e99bc806795cb236735ad8ccb..34b578d29c320abf3330857b3cbfcc937b1f67bf 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -291,17 +291,23 @@ static void *job_thread(void *arg)
 
 static int send_job_files(struct gui *ui)
 {
 
 static int send_job_files(struct gui *ui)
 {
-       int i, ret;
+       int i, ret = 0;
 
        for (i = 0; i < ui->nr_job_files; i++) {
                ret = fio_clients_send_ini(ui->job_files[i]);
 
        for (i = 0; i < ui->nr_job_files; i++) {
                ret = fio_clients_send_ini(ui->job_files[i]);
+               if (ret)
+                       break;
+
                free(ui->job_files[i]);
                ui->job_files[i] = NULL;
                free(ui->job_files[i]);
                ui->job_files[i] = NULL;
-               if (ret)
-                       return ret;
+       }
+       while (i < ui->nr_job_files) {
+               free(ui->job_files[i]);
+               ui->job_files[i] = NULL;
+               i++;
        }
 
        }
 
-       return 0;
+       return ret;
 }
 
 static void start_job_thread(pthread_t *t, struct gui *ui)
 }
 
 static void start_job_thread(pthread_t *t, struct gui *ui)