mirror of https://gitlab.com/qemu-project/qemu
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.
![]() In the xnlx_dp_init() function we create the s->dpcd and s->edid objects with qdev_new(); then in xlnx_dp_realize() we realize the dpcd with qdev_realize() and the edid with qdev_realize_and_unref(). This is inconsistent, and both ways result in a memory leak for the instance_init -> deinit lifecycle tested by device-introspect-test: Indirect leak of 1968 byte(s) in 1 object(s) allocated from: #0 0x5aded4d54e23 in malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/qemu-system-aarch64+0x24ffe23) (BuildId: 9f1e6c5 3fecd904ba5fc1f521d7da080a0e4103b) #1 0x71fbfac9bb09 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x62b09) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75) #2 0x5aded7b9211c in object_new_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:767:15 #3 0x5aded7b92240 in object_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:789:12 #4 0x5aded7b773e4 in qdev_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/qdev.c:149:19 #5 0x5aded54458be in xlnx_dp_init /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/display/xlnx_dp.c:1272:20 Direct leak of 344 byte(s) in 1 object(s) allocated from: #0 0x5aded4d54e23 in malloc (/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/qemu-system-aarch64+0x24ffe23) (BuildId: 9f1e6c53fecd904ba5fc1f521d7da080a0e4103b) #1 0x71fbfac9bb09 in g_malloc (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x62b09) (BuildId: 1eb6131419edb83b2178b682829a6913cf682d75) #2 0x5aded7b9211c in object_new_with_type /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:767:15 #3 0x5aded7b92240 in object_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../qom/object.c:789:12 #4 0x5aded7b773e4 in qdev_new /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/core/qdev.c:149:19 #5 0x5aded5445a56 in xlnx_dp_init /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-asan/../../hw/display/xlnx_dp.c:1275:22 Instead, explicitly object_unref() after we have added the objects as child properties of the device. This means they will automatically be freed when this device is deinited. When we do this, qdev_realize() is the correct way to realize them in xlnx_dp_realize(). Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com> Message-ID: <20250826174956.3010274-3-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 days ago | |
---|---|---|
.. | ||
Kconfig | 7 months ago | |
acpi-vga-stub.c | ||
acpi-vga.c | ||
apple-gfx-mmio.m | 5 months ago | |
apple-gfx-pci.m | 5 months ago | |
apple-gfx.h | 5 months ago | |
apple-gfx.m | 3 months ago | |
artist.c | 2 months ago | |
ati.c | 2 months ago | |
ati_2d.c | ||
ati_dbg.c | ||
ati_int.h | ||
ati_regs.h | ||
bcm2835_fb.c | 5 months ago | |
bochs-display.c | 5 months ago | |
cg3.c | 5 months ago | |
cirrus_vga.c | 5 months ago | |
cirrus_vga_internal.h | ||
cirrus_vga_isa.c | 5 months ago | |
cirrus_vga_rop.h | ||
cirrus_vga_rop2.h | ||
dm163.c | 5 months ago | |
dpcd.c | 5 months ago | |
edid-generate.c | ||
edid-region.c | 5 months ago | |
exynos4210_fimd.c | 5 months ago | |
framebuffer.c | 1 month ago | |
framebuffer.h | 5 months ago | |
g364fb.c | 5 months ago | |
i2c-ddc.c | 5 months ago | |
jazz_led.c | 5 months ago | |
macfb.c | 5 months ago | |
meson.build | 7 months ago | |
next-fb.c | 5 months ago | |
omap_lcdc.c | ||
pl110.c | 5 months ago | |
pl110_template.h | ||
qxl-logger.c | ||
qxl-render.c | 1 month ago | |
qxl.c | 5 months ago | |
qxl.h | 2 years ago | |
ramfb-standalone.c | 2 months ago | |
ramfb-stubs.c | 2 months ago | |
ramfb.c | 2 months ago | |
sii9022.c | 5 months ago | |
sm501.c | 1 month ago | |
ssd0303.c | 5 months ago | |
ssd0323.c | 5 months ago | |
tcx.c | 5 months ago | |
trace-events | 8 months ago | |
trace.h | ||
vga-access.h | ||
vga-helpers.h | 2 years ago | |
vga-isa.c | 5 months ago | |
vga-mmio.c | 5 months ago | |
vga-pci.c | 5 months ago | |
vga.c | 2 months ago | |
vga_int.h | 5 months ago | |
vga_regs.h | 2 years ago | |
vhost-user-gpu-pci.c | ||
vhost-user-gpu.c | 4 months ago | |
vhost-user-vga.c | ||
virtio-dmabuf.c | ||
virtio-gpu-base.c | 2 months ago | |
virtio-gpu-gl.c | 5 months ago | |
virtio-gpu-pci-gl.c | ||
virtio-gpu-pci-rutabaga.c | 5 months ago | |
virtio-gpu-pci.c | 5 months ago | |
virtio-gpu-rutabaga.c | 5 months ago | |
virtio-gpu-udmabuf-stubs.c | ||
virtio-gpu-udmabuf.c | 4 months ago | |
virtio-gpu-virgl.c | 2 months ago | |
virtio-gpu.c | 5 months ago | |
virtio-vga-gl.c | ||
virtio-vga-rutabaga.c | ||
virtio-vga.c | 5 months ago | |
virtio-vga.h | ||
vmware_vga.c | 3 months ago | |
xenfb.c | 9 months ago | |
xlnx_dp.c | 6 days ago |