engines/io_uring: fix leak of 'ld' in error path
authorJens Axboe <axboe@kernel.dk>
Tue, 15 Aug 2023 01:59:20 +0000 (19:59 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Aug 2023 01:59:20 +0000 (19:59 -0600)
Not really important as we're exiting anyway, but this silences some
of the static checkers that like to complain about this sort of
thing.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c

index 7ac7c755b2813c179efbee0202d771def5ba6ea4..6cdf1b4fe4a12342f198b021cd9f6e3740c5aab4 100644 (file)
@@ -1165,10 +1165,13 @@ static int fio_ioring_init(struct thread_data *td)
                        md_size += td->o.mem_align - page_size;
                if (td->o.mem_type == MEM_MALLOC) {
                        ld->md_buf = malloc(md_size);
-                       if (!ld->md_buf)
+                       if (!ld->md_buf) {
+                               free(ld);
                                return 1;
+                       }
                } else {
                        log_err("fio: Only iomem=malloc or mem=malloc is supported\n");
+                       free(ld);
                        return 1;
                }
        }