
On 12/15/2016 06:47 AM, Jiri Denemark wrote:
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0c38b8f..9189a8b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4973,6 +4973,127 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, return ret; }
+int +qemuMonitorJSONParseCPUModelProperty(const char *key, + const virJSONValue *value, + void *opaque) +{ + qemuMonitorCPUModelInfoPtr machine_model = opaque; + size_t n = machine_model->nprops; + bool supported; + + if (!key) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("query-cpu-model-expansion reply data is missing a" + " property name")); + return -1; + } + if (VIR_STRDUP(machine_model->props[n].name, key) < 0) + return -1; + + if (virJSONValueGetBoolean(virJSONValueCopy(value), &supported) < 0) { Ouch, calling virJSONValueCopy() would just leak memory here. If we drop
On Fri, Dec 09, 2016 at 14:38:32 -0500, Jason J. Herne wrote: the "const" requirement from virJSONValueObjectForeachKeyValue (pushed yesterday as v2.5.0-96-gc1cb4cb9f) we can directly pass value. Thanks for letting me know about this update! I was very iffy on passing a boolean this way. I can now rest easy again.
-- - Collin L Walling