From: Kirill Shchetiniuk <[email protected]>
Signed-off-by: Kirill Shchetiniuk <[email protected]>
---
src/qemu/qemu_domain.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c788eb3e2a..5f1ee4e0e3 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3320,7 +3320,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
{
qemuDomainObjPrivate *priv = vm->privateData;
virQEMUDriver *driver = config->priv;
- char *monitorpath;
+ g_autofree char *monitorpath = NULL;
g_autofree char *tmp = NULL;
int n;
size_t i;
@@ -3347,13 +3347,12 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt,
switch (priv->monConfig->type) {
case VIR_DOMAIN_CHR_TYPE_PTY:
- priv->monConfig->data.file.path = monitorpath;
+ priv->monConfig->data.file.path = g_steal_pointer(&monitorpath);
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
- priv->monConfig->data.nix.path = monitorpath;
+ priv->monConfig->data.nix.path = g_steal_pointer(&monitorpath);
break;
default:
- VIR_FREE(monitorpath);
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unsupported monitor type '%1$s'"),
virDomainChrTypeToString(priv->monConfig->type));
--
2.49.0