virSCSIDevicePtr scsi = NULL;
virSCSIVHostDevicePtr host = NULL;
char *tmpPath = NULL;
- bool freeTmpPath = false;
bool includeVFIO = false;
char **tmpPaths = NULL;
int *tmpPerms = NULL;
if (!(tmpPath = virPCIDeviceGetIOMMUGroupDev(pci)))
goto cleanup;
- freeTmpPath = true;
perm = VIR_CGROUP_DEVICE_RW;
if (teardown) {
if (!usb)
goto cleanup;
- tmpPath = (char *)virUSBDeviceGetPath(usb);
+ if (VIR_STRDUP(tmpPath, virUSBDeviceGetPath(usb)) < 0)
+ goto cleanup;
perm = VIR_CGROUP_DEVICE_RW;
break;
if (!scsi)
goto cleanup;
- tmpPath = (char *)virSCSIDeviceGetPath(scsi);
+ if (VIR_STRDUP(tmpPath, virSCSIDeviceGetPath(scsi)) < 0)
+ goto cleanup;
perm = virSCSIDeviceGetReadonly(scsi) ?
VIR_CGROUP_DEVICE_READ : VIR_CGROUP_DEVICE_RW;
}
if (!(host = virSCSIVHostDeviceNew(hostsrc->wwpn)))
goto cleanup;
- tmpPath = (char *)virSCSIVHostDeviceGetPath(host);
+ if (VIR_STRDUP(tmpPath, virSCSIVHostDeviceGetPath(host)) < 0)
+ goto cleanup;
perm = VIR_CGROUP_DEVICE_RW;
}
break;
if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
goto cleanup;
- freeTmpPath = true;
includeVFIO = true;
perm = VIR_CGROUP_DEVICE_RW;
break;
virUSBDeviceFree(usb);
virSCSIDeviceFree(scsi);
virSCSIVHostDeviceFree(host);
- if (freeTmpPath)
- VIR_FREE(tmpPath);
+ VIR_FREE(tmpPath);
return ret;
}