vfio/pci: Fix failure to close file descriptor on error

A new error path fails to close the device file descriptor when
triggered by a ballooning incompatibility within the group.  Fix it.

Fixes: 238e917285 ("vfio/ccw/pci: Allow devices to opt-in for ballooning")
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
Alex Williamson 2018-08-23 10:45:58 -06:00
parent a1c0f88649
commit 8709b3954d

View File

@ -1432,6 +1432,7 @@ int vfio_get_device(VFIOGroup *group, const char *name,
if (!QLIST_EMPTY(&group->device_list)) { if (!QLIST_EMPTY(&group->device_list)) {
error_setg(errp, error_setg(errp,
"Inconsistent device balloon setting within group"); "Inconsistent device balloon setting within group");
close(fd);
return -1; return -1;
} }