From: Jens Axboe Date: Thu, 2 Jun 2022 09:56:51 +0000 (-0600) Subject: engines/nvme: fix 'fd' leak in error handling X-Git-Tag: test-tag-2022-08-09~36 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=3efcb23f09257ecb6db3a895ebd16e133f6432f7;p=fio.git engines/nvme: fix 'fd' leak in error handling Signed-off-by: Jens Axboe --- diff --git a/engines/nvme.c b/engines/nvme.c index 59550def..fe33e167 100644 --- a/engines/nvme.c +++ b/engines/nvme.c @@ -182,8 +182,10 @@ int fio_nvme_report_zones(struct thread_data *td, struct fio_file *f, zones_fetched = 0; zr_len = sizeof(*zr) + (zones_chunks * sizeof(struct nvme_zns_desc)); zr = calloc(1, zr_len); - if (!zr) + if (!zr) { + close(fd); return -ENOMEM; + } ret = nvme_identify(fd, data->nsid, NVME_IDENTIFY_CNS_NS, NVME_CSI_NVM, &ns);