Commit bd9c3903a6 for qemu.org
commit bd9c3903a65cfdcac26925121c35c66d8e6a6a41
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Mon Apr 27 14:52:50 2026 +0400
hw/i386/nitro_enclave: add instance finalize
Property setter strings (vsock, id, parent_role, parent_id) were
never freed because nitro_enclave_machine_info had no
instance_finalize.
Fixes: f1826463d2e8 ("machine/nitro-enclave: New machine type for AWS Nitro Enclaves")
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
diff --git a/hw/i386/nitro_enclave.c b/hw/i386/nitro_enclave.c
index a29f0044d0..1ce9ee3358 100644
--- a/hw/i386/nitro_enclave.c
+++ b/hw/i386/nitro_enclave.c
@@ -337,11 +337,22 @@ static void nitro_enclave_class_init(ObjectClass *oc, const void *data)
"Set parent instance identifier");
}
+static void nitro_enclave_machine_finalize(Object *obj)
+{
+ NitroEnclaveMachineState *nems = NITRO_ENCLAVE_MACHINE(obj);
+
+ g_free(nems->vsock);
+ g_free(nems->id);
+ g_free(nems->parent_role);
+ g_free(nems->parent_id);
+}
+
static const TypeInfo nitro_enclave_machine_info = {
.name = TYPE_NITRO_ENCLAVE_MACHINE,
.parent = TYPE_MICROVM_MACHINE,
.instance_size = sizeof(NitroEnclaveMachineState),
.instance_init = nitro_enclave_machine_initfn,
+ .instance_finalize = nitro_enclave_machine_finalize,
.class_size = sizeof(NitroEnclaveMachineClass),
.class_init = nitro_enclave_class_init,
};