From 81e0ab48dda611e9571dc2e166840205a4208567 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 1 Oct 2015 10:59:51 +0200 Subject: hw: do not pass NULL to memory_region_init from instance_init This causes the region to outlive the object, because it attaches the region to /machine. This is not nice for the "realize" method, but much worse for "instance_init" because it can cause dangling pointers after a simple object_new/object_unref pair. Reported-by: Markus Armbruster Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell Tested-by: Markus Armbruster Signed-off-by: Markus Armbruster Message-Id: <1443689999-12182-3-git-send-email-armbru@redhat.com> Reviewed-by: Thomas Huth --- hw/misc/arm_integrator_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/misc/arm_integrator_debug.c') diff --git a/hw/misc/arm_integrator_debug.c b/hw/misc/arm_integrator_debug.c index 99b720fbb9..6d9dd74e38 100644 --- a/hw/misc/arm_integrator_debug.c +++ b/hw/misc/arm_integrator_debug.c @@ -79,7 +79,7 @@ static void intdbg_control_init(Object *obj) SysBusDevice *sd = SYS_BUS_DEVICE(obj); IntegratorDebugState *s = INTEGRATOR_DEBUG(obj); - memory_region_init_io(&s->iomem, NULL, &intdbg_control_ops, + memory_region_init_io(&s->iomem, obj, &intdbg_control_ops, NULL, "dbg-leds", 0x1000000); sysbus_init_mmio(sd, &s->iomem); } -- cgit 1.4.1