accel/kvm: free device path on finalization
kvm_set_device allocates device via g_strdup, but no instance_finalize existed for the KVM accelerator type. Fixes: aef158b093b9 ("Add class property to configure KVM device node to use") Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
Apr 27, 2026 at 14:53 UTC
e936cfe83085701cb97a1194dbcd06ec9e69d183
1 file changed
+8
accel/kvm/kvm-all.c
+8
@@ -4342,10 +4342,18 @@ static void kvm_accel_class_init(ObjectClass *oc, const void *data)
4342
kvm_arch_accel_class_init(oc);
4343
}
4344
4345
+static void kvm_accel_finalize(Object *obj)
4346
+{
4347
+ KVMState *s = KVM_STATE(obj);
4348
+
4349
+ g_free(s->device);
4350
+}
4351
+
4352
static const TypeInfo kvm_accel_type = {
4353
.name = TYPE_KVM_ACCEL,
4354
.parent = TYPE_ACCEL,
4355
.instance_init = kvm_accel_instance_init,
4356
+ .instance_finalize = kvm_accel_finalize,
4357
.class_init = kvm_accel_class_init,
4358
.instance_size = sizeof(KVMState),
4359
};