qemu-e2k/hw/core
Gonglei 1d45a705fc qdev: Add cleanup logic in device_set_realized() to avoid resource leak
At present, this function doesn't have partial cleanup implemented,
which will cause resource leaks in some scenarios.

Example:

1. Assume that "dc->realize(dev, &local_err)" executes successful
   and local_err == NULL;
2. device hotplug in hotplug_handler_plug() executes but fails
   (it is prone to occur). Then local_err != NULL;
3. error_propagate(errp, local_err) and return. But the resources
   which have been allocated in dc->realize() will be leaked.
Simple backtrace:
  dc->realize()
   |->device_realize
            |->pci_qdev_init()
                |->do_pci_register_device()
                |->etc.

Add fuller cleanup logic which assures that function can
goto appropriate error label as local_err population is
detected at each relevant point.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-09-04 19:15:54 +02:00
..
Makefile.objs cpus: Define callback for QEMU "nmi" command 2014-08-25 13:25:16 +02:00
empty_slot.c empty_slot: QOM cast cleanup 2013-07-29 21:06:37 +02:00
fw-path-provider.c fw-path-provider: Change GPL version to 2+ 2014-04-07 15:36:07 +02:00
hotplug.c define hotplug interface 2014-02-10 10:23:35 +02:00
irq.c irq: Slim conversion of qemu_irq to QOM 2014-07-01 04:12:48 +02:00
loader.c loader: Add load_image_gzipped function. 2014-08-19 19:02:40 +01:00
machine.c intel-iommu: fix coding style issues around in q35.c and machine.c 2014-08-28 23:10:22 +02:00
nmi.c cpus: Define callback for QEMU "nmi" command 2014-08-25 13:25:16 +02:00
null-machine.c machine: Conversion of QEMUMachineInitArgs to MachineState 2014-05-28 17:35:01 +02:00
ptimer.c savevm: Remove all the unneeded version_minimum_id_old (rest) 2014-05-14 15:24:51 +02:00
qdev-properties-system.c qdev: Fix crash when using non-device class name on -global 2014-07-06 09:13:54 +03:00
qdev-properties.c qdev: Display warning about unused -global 2014-06-05 19:20:37 +03:00
qdev.c qdev: Add cleanup logic in device_set_realized() to avoid resource leak 2014-09-04 19:15:54 +02:00
stream.c stream: Remove app argument hack 2013-04-16 10:04:23 +02:00
sysbus.c sysbus: remove unused function sysbus_del_io 2014-08-17 23:25:24 +02:00
uboot_image.h hw: move private headers to hw/ subdirectories. 2013-04-08 18:13:16 +02:00