On Tue, Feb 09, 2021 at 04:42:38PM +0100, Michal Privoznik wrote:
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);
Doh, subtle bug
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|