gfio: fix gc leak
authorJens Axboe <axboe@kernel.dk>
Wed, 21 Mar 2012 11:02:13 +0000 (12:02 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 21 Mar 2012 11:02:13 +0000 (12:02 +0100)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
gfio.c

diff --git a/gfio.c b/gfio.c
index 3dc71fc..d7ae6fe 100644 (file)
--- a/gfio.c
+++ b/gfio.c
@@ -376,11 +376,14 @@ static void ge_destroy(struct gui_entry *ge)
 {
        struct gfio_client *gc = ge->client;
 
-       if (gc && gc->client) {
-               if (ge->state >= GE_STATE_CONNECTED)
-                       fio_client_terminate(gc->client);
+       if (gc) {
+               if (gc->client) {
+                       if (ge->state >= GE_STATE_CONNECTED)
+                               fio_client_terminate(gc->client);
 
-               fio_put_client(gc->client);
+                       fio_put_client(gc->client);
+               }
+               free(gc);
        }
 
        free(ge->job_file);