qemu-patch-raspberry4/include
Peter Maydell 41742927ee hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct
Currently the bitbang_i2c_init() function allocates a
bitbang_i2c_interface struct which it returns.  This is unfortunate
because it means that if the function is used from a DeviceState
init method then the memory will be leaked by an "init then delete"
cycle, as used by the qmp/hmp commands that list device properties.

Since three out of four of the uses of this function are in
device init methods, switch the function to do an in-place
initialization of a struct that can be embedded in the
device state struct of the caller.

This fixes LeakSanitizer leak warnings that have appeared in the
patchew configuration (which only tries to run the sanitizers
for the x86_64-softmmu target) now that we use the bitbang-i2c
code in an x86-64 config.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Tested-by: BALATON Zoltan <balaton@eik.bme.hu>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190702163844.20458-1-peter.maydell@linaro.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2019-07-03 10:51:35 +02:00
..
authz Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
block block: include base when checking image chain for block allocation 2019-07-02 03:53:04 +02:00
chardev Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
crypto Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
disas Clean up a few header guard symbols 2019-06-12 13:20:20 +02:00
exec spapr_pci: Unregister listeners before destroying the IOMMU address space 2019-07-02 09:43:58 +10:00
fpu Supply missing header guards 2019-06-12 13:20:21 +02:00
hw hw/i2c/bitbang_i2c: Use in-place rather than malloc'd bitbang_i2c_interface struct 2019-07-03 10:51:35 +02:00
io Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
libdecnumber Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
migration vmstate: Add support for kernel integer types 2019-06-21 13:23:47 +02:00
monitor monitor: Replace monitor_init() with monitor_init_{hmp, qmp}() 2019-06-18 08:14:17 +02:00
net net/announce: Add optional ID 2019-07-02 10:21:06 +08:00
qapi qapi: remove qmp_unregister_command() 2019-02-18 14:44:05 +01:00
qemu Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qom Include qemu/module.h where needed, drop it from qemu-common.h 2019-06-12 13:18:33 +02:00
scsi Normalize header guard symbol definition. 2019-05-13 08:58:55 +02:00
standard-headers linux headers: update against Linux 5.2-rc1 2019-05-21 16:58:56 +02:00
sysemu target/i386: kvm: Add support for save and restore nested state 2019-06-21 13:23:47 +02:00
ui Supply missing header guards 2019-06-12 13:20:21 +02:00
elf.h linux-user: elf: ELF_HWCAP for s390x 2019-06-07 14:53:26 +02:00
glib-compat.h slirp: Move g_spawn_async_with_fds_qemu compatibility to slirp/ 2019-02-07 15:49:08 +02:00
qemu-common.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
qemu-io.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
trace-tcg.h trace: get rid of generated-events.h/generated-events.c 2016-10-12 09:54:52 +02:00