Local pointer info is freed before return from
iommufd_cdev_get_info_iova_range().
Use 'g_autofree' to avoid the g_free() calls.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
uint32_t ioas_id, Error **errp)
{
VFIOContainerBase *bcontainer = &container->bcontainer;
- struct iommu_ioas_iova_ranges *info;
+ g_autofree struct iommu_ioas_iova_ranges *info = NULL;
struct iommu_iova_range *iova_ranges;
int ret, sz, fd = container->be->fd;
}
bcontainer->pgsizes = info->out_iova_alignment;
- g_free(info);
return 0;
error:
ret = -errno;
- g_free(info);
error_setg_errno(errp, errno, "Cannot get IOVA ranges");
return ret;
}