qemu: driver: Don't copy disk alias in qemuDomainBlocksStatsGather

The string is not modified so it does not make sense to have a copy.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-08-03 14:50:06 +02:00
parent da7123a686
commit 93fad53d3e

View File

@ -11069,7 +11069,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
virHashTablePtr blockstats = NULL; virHashTablePtr blockstats = NULL;
qemuBlockStatsPtr stats; qemuBlockStatsPtr stats;
int nstats; int nstats;
char *diskAlias = NULL; const char *entryname = NULL;
int ret = -1; int ret = -1;
if (*path) { if (*path) {
@ -11084,8 +11084,7 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (VIR_STRDUP(diskAlias, disk->info.alias) < 0) entryname = disk->info.alias;
goto cleanup;
} }
qemuDomainObjEnterMonitor(driver, vm); qemuDomainObjEnterMonitor(driver, vm);
@ -11101,10 +11100,10 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
if (VIR_ALLOC(*retstats) < 0) if (VIR_ALLOC(*retstats) < 0)
goto cleanup; goto cleanup;
if (diskAlias) { if (entryname) {
if (!(stats = virHashLookup(blockstats, diskAlias))) { if (!(stats = virHashLookup(blockstats, entryname))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find statistics for device '%s'"), diskAlias); _("cannot find statistics for device '%s'"), entryname);
goto cleanup; goto cleanup;
} }
@ -11116,7 +11115,6 @@ qemuDomainBlocksStatsGather(virQEMUDriverPtr driver,
ret = nstats; ret = nstats;
cleanup: cleanup:
VIR_FREE(diskAlias);
virHashFree(blockstats); virHashFree(blockstats);
return ret; return ret;
} }