Skip to content
  • Philippe Mathieu-Daudé's avatar
    2da6e36b
    hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize() · 2da6e36b
    Philippe Mathieu-Daudé authored
    
    
    When building with --enable-sanitizers we get:
    
      Direct leak of 32 byte(s) in 2 object(s) allocated from:
          #0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf)
          #1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
          #2 0x561847f02ca2 in usb_packet_init hw/usb/core.c:531:5
          #3 0x561848df4df4 in usb_ehci_init hw/usb/hcd-ehci.c:2575:5
          #4 0x561847c119ac in ehci_sysbus_init hw/usb/hcd-ehci-sysbus.c:73:5
          #5 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9
          #6 0x56184a5bd955 in object_init_with_type qom/object.c:371:9
          #7 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5
          #8 0x56184a5a24d5 in object_initialize qom/object.c:536:5
          #9 0x56184a5a2f6c in object_initialize_child_with_propsv qom/object.c:566:5
          #10 0x56184a5a2e60 in object_initialize_child_with_props qom/object.c:549:10
          #11 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5
          #12 0x561849542d18 in npcm7xx_init hw/arm/npcm7xx.c:427:5
    
    Similarly to commit d710e1e7 ("usb: ehci: fix memory leak in
    ehci"), fix by calling usb_ehci_finalize() to free the USBPacket.
    
    Fixes: 7341ea07
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
    Message-Id: <20210323183701.281152-1-f4bug@amsat.org>
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
    2da6e36b
    hw/usb/hcd-ehci-sysbus: Free USBPacket on instance finalize()
    Philippe Mathieu-Daudé authored
    
    
    When building with --enable-sanitizers we get:
    
      Direct leak of 32 byte(s) in 2 object(s) allocated from:
          #0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf)
          #1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
          #2 0x561847f02ca2 in usb_packet_init hw/usb/core.c:531:5
          #3 0x561848df4df4 in usb_ehci_init hw/usb/hcd-ehci.c:2575:5
          #4 0x561847c119ac in ehci_sysbus_init hw/usb/hcd-ehci-sysbus.c:73:5
          #5 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9
          #6 0x56184a5bd955 in object_init_with_type qom/object.c:371:9
          #7 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5
          #8 0x56184a5a24d5 in object_initialize qom/object.c:536:5
          #9 0x56184a5a2f6c in object_initialize_child_with_propsv qom/object.c:566:5
          #10 0x56184a5a2e60 in object_initialize_child_with_props qom/object.c:549:10
          #11 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5
          #12 0x561849542d18 in npcm7xx_init hw/arm/npcm7xx.c:427:5
    
    Similarly to commit d710e1e7 ("usb: ehci: fix memory leak in
    ehci"), fix by calling usb_ehci_finalize() to free the USBPacket.
    
    Fixes: 7341ea07
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
    Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
    Message-Id: <20210323183701.281152-1-f4bug@amsat.org>
    Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Loading