mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
hw/arm/aspeed: free fmc_model and spi_model on finalization
The fmc_model and spi_model strings are allocated via g_strdup in
property setters but never freed when the machine object is destroyed.
Fixes: 9820e52fbe ("hw/arm/aspeed: Add machine properties to define the flash models")
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
@@ -419,12 +419,21 @@ static void aspeed_machine_class_init(ObjectClass *oc, const void *data)
|
||||
aspeed_machine_class_props_init(oc);
|
||||
}
|
||||
|
||||
static void aspeed_machine_instance_finalize(Object *obj)
|
||||
{
|
||||
AspeedMachineState *bmc = ASPEED_MACHINE(obj);
|
||||
|
||||
g_free(bmc->fmc_model);
|
||||
g_free(bmc->spi_model);
|
||||
}
|
||||
|
||||
static const TypeInfo aspeed_machine_types[] = {
|
||||
{
|
||||
.name = TYPE_ASPEED_MACHINE,
|
||||
.parent = TYPE_MACHINE,
|
||||
.instance_size = sizeof(AspeedMachineState),
|
||||
.instance_init = aspeed_machine_instance_init,
|
||||
.instance_finalize = aspeed_machine_instance_finalize,
|
||||
.class_size = sizeof(AspeedMachineClass),
|
||||
.class_init = aspeed_machine_class_init,
|
||||
.abstract = true,
|
||||
|
||||
Reference in New Issue
Block a user