diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-07-13 02:11:59 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-09-08 18:05:21 +0400 |
commit | e305a16510afa74eec20390479e349402e55ef4c (patch) | |
tree | a7b169b1ea91349fb47db68c74e66d635a11e518 /hw/isa/isa-bus.c | |
parent | bd794065ffffe10721b6a95f1db52f2cc7953196 (diff) | |
download | qemu-e305a16510afa74eec20390479e349402e55ef4c.zip qemu-e305a16510afa74eec20390479e349402e55ef4c.tar.gz qemu-e305a16510afa74eec20390479e349402e55ef4c.tar.bz2 |
portio: keep references on portio
The isa_register_portio_list() function allocates ioports
data/state. Let's keep the reference to this data on some owner. This
isn't enough to fix leaks, but at least, ASAN stops complaining of
direct leaks. Further cleanup would require calling
portio_list_del/destroy().
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/isa/isa-bus.c')
-rw-r--r-- | hw/isa/isa-bus.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index ce74db2..9d07b11 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -131,24 +131,20 @@ void isa_register_ioport(ISADevice *dev, MemoryRegion *io, uint16_t start) isa_init_ioport(dev, start); } -void isa_register_portio_list(ISADevice *dev, uint16_t start, +void isa_register_portio_list(ISADevice *dev, + PortioList *piolist, uint16_t start, const MemoryRegionPortio *pio_start, void *opaque, const char *name) { - PortioList piolist; + assert(piolist && !piolist->owner); /* START is how we should treat DEV, regardless of the actual contents of the portio array. This is how the old code actually handled e.g. the FDC device. */ isa_init_ioport(dev, start); - /* FIXME: the device should store created PortioList in its state. Note - that DEV can be NULL here and that single device can register several - portio lists. Current implementation is leaking memory allocated - in portio_list_init. The leak is not critical because it happens only - at initialization time. */ - portio_list_init(&piolist, OBJECT(dev), pio_start, opaque, name); - portio_list_add(&piolist, isabus->address_space_io, start); + portio_list_init(piolist, OBJECT(dev), pio_start, opaque, name); + portio_list_add(piolist, isabus->address_space_io, start); } static void isa_device_init(Object *obj) |