hw: do not pass NULL to memory_region_init from instance_init
commit243b80c9c5e8be52c141ff976aecd40667aebd61
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 1 Oct 2015 08:59:51 +0000 (1 10:59 +0200)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Wed, 28 Oct 2015 19:48:40 +0000 (28 14:48 -0500)
treed07eba53e29216537ccd763a811418590d6f014f
parent91232d98da2bfe042d4c5744076b488880de3040
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 <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1443689999-12182-3-git-send-email-armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
(cherry picked from commit 81e0ab48dda611e9571dc2e166840205a4208567)

Conflicts:
hw/display/cg3.c
hw/display/tcx.c

* removed context dependencies on &error_fatal/&error_abort

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/arm/pxa2xx.c
hw/display/cg3.c
hw/display/tcx.c
hw/misc/arm_integrator_debug.c
hw/misc/macio/cuda.c
hw/misc/macio/macio.c
hw/pcmcia/pxa2xx.c