mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuDomainDiskPrivateDispose: Prevent dangling 'disk' pointer in blockjob data
Clear the 'disk' member of 'blockjob' as we're freeing the disk object at this point. While this should not normally happen it was observed when other bug allowed the VM to be cleared while other threads didn't yet finish. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -798,7 +798,13 @@ qemuDomainDiskPrivateDispose(void *obj)
|
||||
virObjectUnref(priv->migrSource);
|
||||
g_free(priv->qomName);
|
||||
g_free(priv->nodeCopyOnRead);
|
||||
virObjectUnref(priv->blockjob);
|
||||
if (priv->blockjob) {
|
||||
/* Prevent dangling 'disk' pointer, as the disk object will be freed
|
||||
* right after this function returns if any of the blockjob instance
|
||||
* outlives this for any reason. */
|
||||
priv->blockjob->disk = NULL;
|
||||
virObjectUnref(priv->blockjob);
|
||||
}
|
||||
}
|
||||
|
||||
static virClass *qemuDomainStorageSourcePrivateClass;
|
||||
|
||||
Reference in New Issue
Block a user