On Mon, Dec 16, 2024 at 18:03:53 -0500, Collin Walling wrote: > query-cpu-model-expansion may report an array of deprecated properties. > This array is optional, and may not be supported for a particular > architecture or reported for a particular CPU model. If the output is > present, then capture it and store in a qemuMonitorCPUModelInfo struct > for later use. > > The deprecated features will be retained in qemuCaps->kvm->hostCPU.info > and will be stored in the capabilities cache file under the <hostCPU> > element using the following format: > > <deprecatedFeatures> > <property name='bpb'/> > <property name='csske'/> > <property name='cte'/> > <property name='te'/> > </deprecatedFeatures> > > At this time the data is only queried, parsed, and cached. The data > will be utilized in a subsequent patch. > > Signed-off-by: Collin Walling <walling@xxxxxxxxxxxxx> > Reviewed-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> > --- > src/qemu/qemu_capabilities.c | 31 +++++++++++++++++++ > src/qemu/qemu_monitor.c | 7 +++++ > src/qemu/qemu_monitor.h | 1 + > src/qemu/qemu_monitor_json.c | 18 +++++++++++ > .../qemucapabilitiesdata/caps_9.1.0_s390x.xml | 6 ++++ > .../qemucapabilitiesdata/caps_9.2.0_s390x.xml | 6 ++++ > 6 files changed, 69 insertions(+) ... > diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c > index 73f37d26eb..8590a1a0a5 100644 > --- a/src/qemu/qemu_monitor.c > +++ b/src/qemu/qemu_monitor.c > @@ -3306,6 +3306,7 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfo *model_info) > g_free(model_info->props[i].value.string); > } > > + g_strfreev(model_info->deprecated_props); > g_free(model_info->props); > g_free(model_info->name); > g_free(model_info); > @@ -3350,6 +3351,12 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig) > } > } > > + if (orig->deprecated_props) { > + copy->deprecated_props = g_new0(char *, > + g_strv_length(orig->deprecated_props)); The memory allocated here is leaked as the pointer is overwritten by the following line. > + copy->deprecated_props = g_strdupv(orig->deprecated_props); This is enough to create the copy and you can safely call g_strdupv on NULL so there's no need for the if statement. > + } > + > return copy; > } > Jirka