On Tue, Jun 10, 2025 at 09:42:41AM +0200, Cédric Le Goater wrote: > > @@ -478,9 +491,14 @@ void vfio_device_unprepare(VFIODevice *vbasedev) > > for (i = 0; i < vbasedev->num_regions; i++) { > > g_free(vbasedev->reginfo[i]); > > + if (vbasedev->region_fds != NULL && vbasedev->region_fds[i] != -1) > > { > > + close(vbasedev->region_fds[i]); > > + } > > + > > Adding a small helper to retrieve the region fd from the cache, > would hide some of the implementation details here and below in > vfio_region_mmap()
I can add a region_get_fd() helper, but I can't use it here - we should only close the fd if it's a per-region fd. I'll make this call a region_cleanup() or similar. regards john