The freeing function will be needed to undo failures in allocation.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 61 +++++++++++++++++++++---------------------
1 file changed, 31 insertions(+), 30 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b919da6eab..8d1ecc0140 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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:
* @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
qemuStorageSourcePrivateDataAssignSecinfo(qemuDomainSecretInfo **secinfo,
char **alias)
--
2.31.1