A <machine/> element can have "deprecated" attribute that
corresponds to 'deprecated' member of _virQEMUCapsMachineType
struct. But the member is of boolean type. Therefore, the string
returned by virXMLPropString() must be freed.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 4a6ef2e383..ebd6607888 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4063,7 +4063,11 @@ virQEMUCapsLoadMachines(virQEMUCapsAccelPtr caps,
caps->machineTypes[i].defaultCPU = virXMLPropString(nodes[i],
"defaultCPU");
caps->machineTypes[i].defaultRAMid = virXMLPropString(nodes[i],
"defaultRAMid");
- caps->machineTypes[i].deprecated = virXMLPropString(nodes[i],
"deprecated");
+
+ str = virXMLPropString(nodes[i], "deprecated");
+ if (STREQ_NULLABLE(str, "yes"))
+ caps->machineTypes[i].deprecated = true;
+ VIR_FREE(str);
}
return 0;
--
2.26.2