提交 11fa712c 编写于 作者: M Michal Privoznik

virHostdevGetPCIHostDeviceList: Use VIR_AUTOPTR for virPCIDevice

Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 7cf29630
...@@ -227,7 +227,7 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) ...@@ -227,7 +227,7 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
for (i = 0; i < nhostdevs; i++) { for (i = 0; i < nhostdevs; i++) {
virDomainHostdevDefPtr hostdev = hostdevs[i]; virDomainHostdevDefPtr hostdev = hostdevs[i];
virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci; virDomainHostdevSubsysPCIPtr pcisrc = &hostdev->source.subsys.u.pci;
virPCIDevicePtr pci; VIR_AUTOPTR(virPCIDevice) pci = NULL;
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
continue; continue;
...@@ -251,10 +251,10 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs) ...@@ -251,10 +251,10 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhostdevs)
virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM); virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
if (virPCIDeviceListAdd(pcidevs, pci) < 0) { if (virPCIDeviceListAdd(pcidevs, pci) < 0) {
virPCIDeviceFree(pci);
virObjectUnref(pcidevs); virObjectUnref(pcidevs);
return NULL; return NULL;
} }
pci = NULL;
} }
return pcidevs; return pcidevs;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册