On Mon, May 10, 2021 at 03:24:39PM +0200, Peter Krempa wrote: > On Mon, May 10, 2021 at 15:16:11 +0200, Pavel Hrdina wrote: > > When QEMU introduces new firmware features libvirt will fail until we > > list that feature in our code as well which doesn't sound right. > > > > We should simply ignore the new feature until we add a proper support > > for it. > > > > Reported-by: Laszlo Ersek <lersek@xxxxxxxxxx> > > Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> > > --- > > src/qemu/qemu_firmware.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c > > index 94e88ebe4b..e37a7edefa 100644 > > --- a/src/qemu/qemu_firmware.c > > +++ b/src/qemu/qemu_firmware.c > > @@ -567,6 +567,7 @@ qemuFirmwareFeatureParse(const char *path, > > virJSONValue *featuresJSON; > > g_autoptr(qemuFirmwareFeature) features = NULL; > > Not related to this patch, but a bug nevertheless. 'features' is an > array allocated by: > > features = g_new0(qemuFirmwareFeature, nfeatures); > > Using g_autoptr calls the proper destructor function only for the first > element! I don't think this is true. For qemuFirmwareFeature the auto-cleanup is defined using: static void qemuFirmwareFeatureFree(qemuFirmwareFeature *features) { g_free(features); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuFirmwareFeature, qemuFirmwareFeatureFree); So it actually frees the whole array. > The whole premise of declaring an autoptr function for an enum type > seems a bit flawed to me! Agreed, seems a bit overkill and simple g_autofree qemuFirmwareFeature *features; should be good enough. Pavel
Attachment:
signature.asc
Description: PGP signature