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>
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;