The string is not modified so it does not make sense to have a copy.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5dee701dc4..f36d4dc37f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11071,7 +11071,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
virHashTablePtr blockstats = NULL;
qemuBlockStatsPtr stats;
int nstats;
- char *diskAlias = NULL;
+ const char *entryname = NULL;
int ret = -1;
if (*path) {
@@ -11086,8 +11086,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
goto cleanup;
}
- if (VIR_STRDUP(diskAlias, disk->info.alias) < 0)
- goto cleanup;
+ entryname = disk->info.alias;
}
qemuDomainObjEnterMonitor(driver, vm);
@@ -11103,10 +11102,10 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
if (VIR_ALLOC(*retstats) < 0)
goto cleanup;
- if (diskAlias) {
- if (!(stats = virHashLookup(blockstats, diskAlias))) {
+ if (entryname) {
+ if (!(stats = virHashLookup(blockstats, entryname))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
- _("cannot find statistics for device '%s'"),
diskAlias);
+ _("cannot find statistics for device '%s'"),
entryname);
goto cleanup;
}
@@ -11118,7 +11117,6 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
ret = nstats;
cleanup:
- VIR_FREE(diskAlias);
virHashFree(blockstats);
return ret;
}
--
2.16.2