mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-30 12:31:16 +00:00
qemu: Reorder cleanup in qemuStateCleanup()
This function is supposed to clean up virQEMUDriver structure and free individual members. However, it's doing that in random order which makes it hard to track which members are being freed and which are not. Do the free in reverse order than the structure definition - assuming that the most important members (like mutex) are declared first and freed last. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
599f9c73d4
commit
7cf76d4e3a
@ -1122,38 +1122,29 @@ qemuStateCleanup(void)
|
|||||||
if (!qemu_driver)
|
if (!qemu_driver)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
virObjectUnref(qemu_driver->migrationErrors);
|
||||||
|
virObjectUnref(qemu_driver->closeCallbacks);
|
||||||
|
virLockManagerPluginUnref(qemu_driver->lockManager);
|
||||||
|
virSysinfoDefFree(qemu_driver->hostsysinfo);
|
||||||
|
virPortAllocatorRangeFree(qemu_driver->migrationPorts);
|
||||||
|
virPortAllocatorRangeFree(qemu_driver->webSocketPorts);
|
||||||
|
virPortAllocatorRangeFree(qemu_driver->remotePorts);
|
||||||
|
virHashFree(qemu_driver->sharedDevices);
|
||||||
|
virObjectUnref(qemu_driver->hostdevMgr);
|
||||||
|
virObjectUnref(qemu_driver->securityManager);
|
||||||
|
virObjectUnref(qemu_driver->domainEventState);
|
||||||
|
virObjectUnref(qemu_driver->qemuCapsCache);
|
||||||
|
virObjectUnref(qemu_driver->xmlopt);
|
||||||
|
virObjectUnref(qemu_driver->caps);
|
||||||
|
ebtablesContextFree(qemu_driver->ebtables);
|
||||||
|
VIR_FREE(qemu_driver->qemuImgBinary);
|
||||||
|
virObjectUnref(qemu_driver->domains);
|
||||||
|
virThreadPoolFree(qemu_driver->workerPool);
|
||||||
|
|
||||||
if (qemu_driver->lockFD != -1)
|
if (qemu_driver->lockFD != -1)
|
||||||
virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD);
|
virPidFileRelease(qemu_driver->config->stateDir, "driver", qemu_driver->lockFD);
|
||||||
virThreadPoolFree(qemu_driver->workerPool);
|
|
||||||
virObjectUnref(qemu_driver->config);
|
virObjectUnref(qemu_driver->config);
|
||||||
virObjectUnref(qemu_driver->hostdevMgr);
|
|
||||||
virHashFree(qemu_driver->sharedDevices);
|
|
||||||
virObjectUnref(qemu_driver->caps);
|
|
||||||
virObjectUnref(qemu_driver->qemuCapsCache);
|
|
||||||
|
|
||||||
virObjectUnref(qemu_driver->domains);
|
|
||||||
virPortAllocatorRangeFree(qemu_driver->remotePorts);
|
|
||||||
virPortAllocatorRangeFree(qemu_driver->webSocketPorts);
|
|
||||||
virPortAllocatorRangeFree(qemu_driver->migrationPorts);
|
|
||||||
virObjectUnref(qemu_driver->migrationErrors);
|
|
||||||
|
|
||||||
virObjectUnref(qemu_driver->xmlopt);
|
|
||||||
|
|
||||||
virSysinfoDefFree(qemu_driver->hostsysinfo);
|
|
||||||
|
|
||||||
virObjectUnref(qemu_driver->closeCallbacks);
|
|
||||||
|
|
||||||
VIR_FREE(qemu_driver->qemuImgBinary);
|
|
||||||
|
|
||||||
virObjectUnref(qemu_driver->securityManager);
|
|
||||||
|
|
||||||
ebtablesContextFree(qemu_driver->ebtables);
|
|
||||||
|
|
||||||
/* Free domain callback list */
|
|
||||||
virObjectUnref(qemu_driver->domainEventState);
|
|
||||||
|
|
||||||
virLockManagerPluginUnref(qemu_driver->lockManager);
|
|
||||||
|
|
||||||
virMutexDestroy(&qemu_driver->lock);
|
virMutexDestroy(&qemu_driver->lock);
|
||||||
VIR_FREE(qemu_driver);
|
VIR_FREE(qemu_driver);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user