From: Michal Privoznik Date: Tue, 7 Nov 2017 14:12:33 +0000 (+0100) Subject: qemu: Set alias for memory cell in qemuBuildMemoryCellBackendStr X-Git-Tag: v3.10.0-rc1~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d52e6043bc5b19484ce5489345f9b9be61d95c1c;p=thirdparty%2Flibvirt.git qemu: Set alias for memory cell in qemuBuildMemoryCellBackendStr Very soon qemuBuildMemoryBackendStr() is going to use memory cell aliases. Therefore set one. At the same time, move it a bit further - if virAsprintf() fails, there's no point in setting rest of the members. Signed-off-by: Michal Privoznik Reviewed-by: John Ferlan --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 03a8056d9e..bf16d71f9a 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3486,12 +3486,13 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def, unsigned long long memsize = virDomainNumaGetNodeMemorySize(def->numa, cell); + if (virAsprintf(&alias, "ram-node%zu", cell) < 0) + goto cleanup; + *backendStr = NULL; mem.size = memsize; mem.targetNode = cell; - - if (virAsprintf(&alias, "ram-node%zu", cell) < 0) - goto cleanup; + mem.info.alias = alias; if ((rc = qemuBuildMemoryBackendStr(&props, &backendType, cfg, priv->qemuCaps, def, &mem, priv->autoNodeset, false)) < 0)