Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/libvirt-domain.c | 12 ++++++------
src/qemu/qemu_driver.c | 18 +++++-------------
src/remote/remote_daemon_dispatch.c | 2 +-
3 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index eb66999f07..33c0e1949d 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -11924,15 +11924,15 @@ virDomainFSInfoFree(virDomainFSInfoPtr info)
if (!info)
return;
- VIR_FREE(info->mountpoint);
- VIR_FREE(info->name);
- VIR_FREE(info->fstype);
+ g_free(info->mountpoint);
+ g_free(info->name);
+ g_free(info->fstype);
for (i = 0; i < info->ndevAlias; i++)
- VIR_FREE(info->devAlias[i]);
- VIR_FREE(info->devAlias);
+ g_free(info->devAlias[i]);
+ g_free(info->devAlias);
- VIR_FREE(info);
+ g_free(info);
}
/**
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 812ff45707..f905ef4675 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -21849,17 +21849,14 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent,
size_t i;
virDomainDiskDefPtr diskDef;
- if (VIR_ALLOC(ret) < 0)
- goto error;
+ ret = g_new0(virDomainFSInfo, 1);
ret->mountpoint = g_strdup(agent->mountpoint);
ret->name = g_strdup(agent->name);
ret->fstype = g_strdup(agent->fstype);
- if (agent->disks &&
- VIR_ALLOC_N(ret->devAlias, agent->ndisks) < 0)
- goto error;
-
+ if (agent->disks)
+ ret->devAlias = g_new0(char *, agent->ndisks);
ret->ndevAlias = agent->ndisks;
for (i = 0; i < ret->ndevAlias; i++) {
@@ -21875,10 +21872,6 @@ qemuAgentFSInfoToPublic(qemuAgentFSInfoPtr agent,
}
return ret;
-
- error:
- virDomainFSInfoFree(ret);
- return NULL;
}
/* Returns: 0 on success
@@ -21896,8 +21889,7 @@ virDomainFSInfoFormat(qemuAgentFSInfoPtr *agentinfo,
if (nagentinfo < 0)
return ret;
- if (VIR_ALLOC_N(info_ret, nagentinfo) < 0)
- goto cleanup;
+ info_ret = g_new0(virDomainFSInfoPtr, nagentinfo);
for (i = 0; i < nagentinfo; i++) {
if (!(info_ret[i] = qemuAgentFSInfoToPublic(agentinfo[i], vmdef)))
@@ -21915,7 +21907,7 @@ virDomainFSInfoFormat(qemuAgentFSInfoPtr *agentinfo,
if (info_ret)
virDomainFSInfoFree(info_ret[i]);
}
- VIR_FREE(info_ret);
+ g_free(info_ret);
return ret;
}
diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c
index 9c294ddc39..70fdb7f36b 100644
--- a/src/remote/remote_daemon_dispatch.c
+++ b/src/remote/remote_daemon_dispatch.c
@@ -7032,7 +7032,7 @@ remoteDispatchDomainGetFSInfo(virNetServerPtr server G_GNUC_UNUSED,
if (ninfo >= 0)
for (i = 0; i < ninfo; i++)
virDomainFSInfoFree(info[i]);
- VIR_FREE(info);
+ g_free(info);
return rv;
}
--
2.21.0