mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: domain: Move qemuDomainObjPrivateAlloc after qemuDomainObjPrivateFree
The freeing function will be needed to undo failures in allocation. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
1318e54bfc
commit
e908a8e0e2
@ -1772,36 +1772,6 @@ qemuDomainObjStopWorker(virDomainObj *dom)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *
|
|
||||||
qemuDomainObjPrivateAlloc(void *opaque)
|
|
||||||
{
|
|
||||||
qemuDomainObjPrivate *priv;
|
|
||||||
|
|
||||||
priv = g_new0(qemuDomainObjPrivate, 1);
|
|
||||||
|
|
||||||
if (qemuDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) {
|
|
||||||
virReportSystemError(errno, "%s",
|
|
||||||
_("Unable to init qemu driver mutexes"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(priv->devs = virChrdevAlloc()))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
priv->blockjobs = virHashNew(virObjectFreeHashData);
|
|
||||||
|
|
||||||
/* agent commands block by default, user can choose different behavior */
|
|
||||||
priv->agentTimeout = VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK;
|
|
||||||
priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
|
|
||||||
priv->driver = opaque;
|
|
||||||
|
|
||||||
return priv;
|
|
||||||
|
|
||||||
error:
|
|
||||||
VIR_FREE(priv);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainObjPrivateDataClear:
|
* qemuDomainObjPrivateDataClear:
|
||||||
* @priv: domain private data
|
* @priv: domain private data
|
||||||
@ -1922,6 +1892,37 @@ qemuDomainObjPrivateFree(void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void *
|
||||||
|
qemuDomainObjPrivateAlloc(void *opaque)
|
||||||
|
{
|
||||||
|
qemuDomainObjPrivate *priv;
|
||||||
|
|
||||||
|
priv = g_new0(qemuDomainObjPrivate, 1);
|
||||||
|
|
||||||
|
if (qemuDomainObjInitJob(&priv->job, &qemuPrivateJobCallbacks) < 0) {
|
||||||
|
virReportSystemError(errno, "%s",
|
||||||
|
_("Unable to init qemu driver mutexes"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(priv->devs = virChrdevAlloc()))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
priv->blockjobs = virHashNew(virObjectFreeHashData);
|
||||||
|
|
||||||
|
/* agent commands block by default, user can choose different behavior */
|
||||||
|
priv->agentTimeout = VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK;
|
||||||
|
priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
|
||||||
|
priv->driver = opaque;
|
||||||
|
|
||||||
|
return priv;
|
||||||
|
|
||||||
|
error:
|
||||||
|
VIR_FREE(priv);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuStorageSourcePrivateDataAssignSecinfo(qemuDomainSecretInfo **secinfo,
|
qemuStorageSourcePrivateDataAssignSecinfo(qemuDomainSecretInfo **secinfo,
|
||||||
char **alias)
|
char **alias)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user