On 27/09/2017 13:38, Thomas Huth wrote: > Hi Gerd, > > today, I've run into this issue reported by valgrind: > > $ valgrind x86_64-softmmu/qemu-system-x86_64 -device usb-ehci -nographic -S > ==2043== Memcheck, a memory error detector > ==2043== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. > ==2043== Using Valgrind-3.12.0 and LibVEX; rerun with -h for copyright info > ==2043== Command: x86_64-softmmu/qemu-system-x86_64 -device usb-ehci > -nographic -S > ==2043== > QEMU 2.10.50 monitor - type 'help' for more information > (qemu) device_add usb-tablet > (qemu) device_add usb-tablet > (qemu) device_add usb-tablet > (qemu) device_add usb-tablet > (qemu) device_add usb-tablet > (qemu) device_add usb-tablet > ==2043== Invalid read of size 8 > ==2043== at 0x60EF50: object_unparent (object.c:445)
This object_unparent is not needed anymore. See commit 69382d8b3e8600b349c191394d761dcb480502cf Author: Igor Mammedov <imamm...@redhat.com> Date: Mon Jul 25 11:59:22 2016 +0200 qdev: Fix object reference leak in case device.realize() fails Paolo > ==2043== by 0x580F0D: usb_try_create_simple (bus.c:346) > ==2043== by 0x581BEB: usb_claim_port (bus.c:451) > ==2043== by 0x582310: usb_qdev_realize (bus.c:257) > ==2043== by 0x4CB399: device_set_realized (qdev.c:914) > ==2043== by 0x60E26D: property_set_bool (object.c:1886) > ==2043== by 0x61235E: object_property_set_qobject (qom-qobject.c:27) > ==2043== by 0x61000F: object_property_set_bool (object.c:1162) > ==2043== by 0x4567C3: qdev_device_add (qdev-monitor.c:630) > ==2043== by 0x456D52: qmp_device_add (qdev-monitor.c:807) > ==2043== by 0x470A99: hmp_device_add (hmp.c:1933) > ==2043== by 0x3679C3: handle_hmp_command (monitor.c:3123) > ==2043== Address 0x2100b430 is 32 bytes inside a block of size 6,448 free'd > ==2043== at 0x4C2ACDD: free (vg_replace_malloc.c:530) > ==2043== by 0xA04EBCD: g_free (in /usr/lib64/libglib-2.0.so.0.5000.3) > ==2043== by 0x60F735: object_finalize (object.c:471) > ==2043== by 0x60F735: object_unref (object.c:902) > ==2043== by 0x60E746: object_property_del_child.isra.7 (object.c:427) > ==2043== by 0x4CB2B2: device_set_realized (qdev.c:994) > ==2043== by 0x60E26D: property_set_bool (object.c:1886) > ==2043== by 0x61235E: object_property_set_qobject (qom-qobject.c:27) > ==2043== by 0x61000F: object_property_set_bool (object.c:1162) > ==2043== by 0x580EBB: usb_try_create_simple (bus.c:341) > ==2043== by 0x581BEB: usb_claim_port (bus.c:451) > ==2043== by 0x582310: usb_qdev_realize (bus.c:257) > ==2043== by 0x4CB399: device_set_realized (qdev.c:914) > ==2043== Block was alloc'd at > ==2043== at 0x4C29BE3: malloc (vg_replace_malloc.c:299) > ==2043== by 0xA04EABD: g_malloc (in /usr/lib64/libglib-2.0.so.0.5000.3) > ==2043== by 0x60EE0C: object_new_with_type (object.c:482) > ==2043== by 0x4CA080: qdev_try_create (qdev.c:152) > ==2043== by 0x580E7A: usb_try_create_simple (bus.c:336) > ==2043== by 0x581BEB: usb_claim_port (bus.c:451) > ==2043== by 0x582310: usb_qdev_realize (bus.c:257) > ==2043== by 0x4CB399: device_set_realized (qdev.c:914) > ==2043== by 0x60E26D: property_set_bool (object.c:1886) > ==2043== by 0x61235E: object_property_set_qobject (qom-qobject.c:27) > ==2043== by 0x61000F: object_property_set_bool (object.c:1162) > ==2043== by 0x4567C3: qdev_device_add (qdev-monitor.c:630) > > Any idea what could be wrong here? > > Thomas > >