diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 98b309b0f9..11ad5f41dc 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -86,10 +86,8 @@ virCPUDefFree(virCPUDefPtr def) virCPUDefFreeModel(def); - for (i = 0; i < def->ncells; i++) { + for (i = 0; i < def->ncells; i++) virBitmapFree(def->cells[i].cpumask); - VIR_FREE(def->cells[i].cpustr); - } VIR_FREE(def->cells); VIR_FREE(def->vendor_id); @@ -162,9 +160,6 @@ virCPUDefCopy(const virCPUDef *cpu) if (!copy->cells[i].cpumask) goto error; - - if (VIR_STRDUP(copy->cells[i].cpustr, cpu->cells[i].cpustr) < 0) - goto error; } copy->cells_cpus = cpu->cells_cpus; } @@ -601,16 +596,21 @@ virCPUDefFormatBuf(virBufferPtr buf, virBufferAdjustIndent(buf, 2); for (i = 0; i < def->ncells; i++) { virMemAccess memAccess = def->cells[i].memAccess; + char *cpustr = NULL; + + if (!(cpustr = virBitmapFormat(def->cells[i].cpumask))) + return -1; virBufferAddLit(buf, "cells[i].cpustr); + virBufferAsprintf(buf, " cpus='%s'", cpustr); virBufferAsprintf(buf, " memory='%llu'", def->cells[i].mem); virBufferAddLit(buf, " unit='KiB'"); if (memAccess) virBufferAsprintf(buf, " memAccess='%s'", virMemAccessTypeToString(memAccess)); virBufferAddLit(buf, "/>\n"); + VIR_FREE(cpustr); } virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index e201656205..d6efba71f7 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -104,7 +104,6 @@ typedef struct _virCellDef virCellDef; typedef virCellDef *virCellDefPtr; struct _virCellDef { virBitmapPtr cpumask; /* CPUs that are part of this node */ - char *cpustr; /* CPUs stored in string form for dumpxml */ unsigned long long mem; /* Node memory in kB */ virMemAccess memAccess; }; diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 8879c16711..9284969950 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -749,9 +749,7 @@ virDomainNumaDefCPUParseXML(virCPUDefPtr def, if (ncpus <= 0) goto cleanup; def->cells_cpus += ncpus; - - def->cells[cur_cell].cpustr = tmp; - tmp = NULL; + VIR_FREE(tmp); ctxt->node = nodes[i]; if (virDomainParseMemory("./@memory", "./@unit", ctxt, diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml index 8912017a03..73dfdf587f 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memnode.xml @@ -17,7 +17,7 @@ - + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml index ffc57cf57d..75421252a5 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numatune-memnode.xml @@ -17,7 +17,7 @@ - +