You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/include/hw/arm
Peter Maydell 2e27650bdd hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects
In stm32f250_soc_initfn() we mostly use the standard pattern
for child objects of calling object_initialize_child(). However
for s->adc_irqs we call object_new() and then later qdev_realize(),
and we never unref the object on deinit. This causes a leak,
detected by ASAN on the device-introspect-test:

Indirect leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x5b9fc4789de3 in malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/qemu-system-arm+0x21f1de3) (BuildId: 267a2619a026ed91c78a07b1eb2ef15381538efe)
    #1 0x740de3f28b09 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x62b09) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
    #2 0x740de3f3e4d8 in g_strdup (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x784d8) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75)
    #3 0x5b9fc70159e1 in g_strdup_inline /usr/include/glib-2.0/glib/gstrfuncs.h:321:10
    #4 0x5b9fc70159e1 in object_property_try_add /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:1276:18
    #5 0x5b9fc7015f94 in object_property_add /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:1294:12
    #6 0x5b9fc701b900 in object_add_link_prop /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:2021:10
    #7 0x5b9fc701b3fc in object_property_add_link /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:2037:12
    #8 0x5b9fc4c299fb in qdev_init_gpio_out_named /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/gpio.c:90:9
    #9 0x5b9fc4c29b26 in qdev_init_gpio_out /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/gpio.c:101:5
    #10 0x5b9fc4c0f77a in or_irq_init /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/or-irq.c:70:5
    #11 0x5b9fc70257e1 in object_init_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:428:9
    #12 0x5b9fc700cd4b in object_initialize_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:570:5
    #13 0x5b9fc700e66d in object_new_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:774:5
    #14 0x5b9fc700e750 in object_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:789:12
    #15 0x5b9fc68b2162 in stm32f205_soc_initfn /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/arm/stm32f205_soc.c:69:26

Switch to using object_initialize_child() like all our
other child objects for this SoC object.

Cc: qemu-stable@nongnu.org
Fixes: b63041c8f6 ("STM32F205: Connect the ADC devices")
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250821154229.2417453-1-peter.maydell@linaro.org
1 week ago
..
allwinner-a10.h include: Rename sysemu/ -> system/ 9 months ago
allwinner-h3.h include: Rename sysemu/ -> system/ 9 months ago
allwinner-r40.h include: Rename sysemu/ -> system/ 9 months ago
armsse-version.h
armsse.h hw/arm: Set number of MPU regions correctly for an505, an521, an524 2 years ago
armv7m.h hw/arm/armv7m: alias the NVIC "num-prio-bits" property 2 years ago
aspeed.h hw/arm/aspeed: Add second SPI chip to Aspeed model 2 months ago
aspeed_soc.h hw/arm/aspeed_ast27x0-tsp: Introduce AST27x0 A1 TSP SoC 4 months ago
bcm2835_peripherals.h hw/arm: Connect OTP device to BCM2835 1 year ago
bcm2836.h hw/arm/bcm2853_peripherals: Split out common part of peripherals 2 years ago
bcm2838.h hw/arm/bcm2838: Add GIC-400 to BCM2838 SoC 2 years ago
bcm2838_peripherals.h hw/arm/bcm2838_peripherals: Add clock_isp stub 2 years ago
boot.h hw/arm: make cpu targeted by arm_load_kernel the primary CPU. 3 months ago
bsa.h target/arm: Implement SEL2 physical and virtual timers 6 months ago
digic.h
exynos4210.h hw/arm/exynos4210: Get arm_boot_info declaration from 'hw/arm/boot.h' 2 years ago
fdt.h
fsl-imx6.h include/system: Move exec/memory.h to system/memory.h 5 months ago
fsl-imx6ul.h include/system: Move exec/memory.h to system/memory.h 5 months ago
fsl-imx7.h hw/pci-host/designware: Expose MSI IRQ 8 months ago
fsl-imx8mp.h hw/arm/fsl-imx8mp: Remove unused define 5 months ago
fsl-imx25.h include/system: Move exec/memory.h to system/memory.h 5 months ago
fsl-imx31.h include/system: Move exec/memory.h to system/memory.h 5 months ago
linux-boot-if.h
max78000_soc.h MAX78000: Add AES to SOC 2 months ago
msf2-soc.h hw/arm/msf2: Simplify setting MachineClass::valid_cpu_types[] 2 years ago
npcm7xx.h hw/misc: Move NPCM7XX CLK to NPCM CLK 7 months ago
npcm8xx.h hw/arm: Add GMAC devices to NPCM8XX SoC 3 months ago
nrf51.h
nrf51_soc.h hw/arm/nrf51: Rename ARMv7MState 'cpu' -> 'armv7m' 8 months ago
omap.h hw/arm: Replace TABs for spaces in OMAP board and device code 4 months ago
primecell.h
raspberrypi-fw-defs.h hw/misc: Implement mailbox properties for customer OTP and device specific private keys 1 year ago
raspi_platform.h hw/arm: Add memory region for BCM2837 RPiVid ASB 2 years ago
sharpsl.h hw/arm: Replace TABs for spaces in OMAP board and device code 4 months ago
smmu-common.h hw/arm/smmu: Introduce smmu_configs_inv_sid_range() helper 6 months ago
smmuv3.h hw/arm/smmuv3: Add knob to choose translation stage and enable stage-2 2 years ago
soc_dma.h hw/arm: Replace TABs for spaces in OMAP board and device code 4 months ago
stm32f100_soc.h hw/arm/stm32f100: Report error when incorrect CPU is used 2 years ago
stm32f205_soc.h hw/arm/stm32f205_soc: Don't leak TYPE_OR_IRQ objects 1 week ago
stm32f405_soc.h hw/arm/stm32f405: Add RCC device to stm32f405 SoC 11 months ago
stm32l4x5_soc.h include/system: Move exec/memory.h to system/memory.h 5 months ago
virt.h hw/arm/virt-acpi-build: Modify the DSDT ACPI table to enable ACPI PCI hotplug 2 months ago
xlnx-versal.h hw/arm/xlnx: Connect secondary CGEM IRQs 11 months ago
xlnx-zynqmp.h hw/arm/xlnx: Connect secondary CGEM IRQs 11 months ago