提交 f9765165 编写于 作者: M Michal Privoznik

qemuDomainGetHostdevPath: Use more g_autoptr()/g_autofree

There are several variables which could be automatically freed
upon return from the function. I'm not changing @tmpPaths (which
is a string list) because it is going to be removed in next
commit.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 6f43c505
...@@ -13852,14 +13852,14 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, ...@@ -13852,14 +13852,14 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi; virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host; virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host;
virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev; virDomainHostdevSubsysMediatedDevPtr mdevsrc = &dev->source.subsys.u.mdev;
virPCIDevicePtr pci = NULL; g_autoptr(virPCIDevice) pci = NULL;
virUSBDevicePtr usb = NULL; g_autoptr(virUSBDevice) usb = NULL;
virSCSIDevicePtr scsi = NULL; g_autoptr(virSCSIDevice) scsi = NULL;
virSCSIVHostDevicePtr host = NULL; g_autoptr(virSCSIVHostDevice) host = NULL;
char *tmpPath = NULL; g_autofree char *tmpPath = NULL;
bool includeVFIO = false; bool includeVFIO = false;
char **tmpPaths = NULL; char **tmpPaths = NULL;
int *tmpPerms = NULL; g_autofree int *tmpPerms = NULL;
size_t tmpNpaths = 0; size_t tmpNpaths = 0;
int perm = 0; int perm = 0;
...@@ -13986,12 +13986,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def, ...@@ -13986,12 +13986,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
ret = 0; ret = 0;
cleanup: cleanup:
virStringListFreeCount(tmpPaths, tmpNpaths); virStringListFreeCount(tmpPaths, tmpNpaths);
VIR_FREE(tmpPerms);
virPCIDeviceFree(pci);
virUSBDeviceFree(usb);
virSCSIDeviceFree(scsi);
virSCSIVHostDeviceFree(host);
VIR_FREE(tmpPath);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册