VirtualBox

Ignore:
Timestamp:
Feb 28, 2022 3:28:20 PM (3 years ago)
Author:
vboxsync
Message:

Devices/USB: Fix memory leak introduced by r150140, and get rid of the VUSBDEV member of the roothub which is not used anyway, bugref:10196

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/USB/VUSBInternal.h

    r93979 r93989  
    291291int vusbDevInit(PVUSBDEV pDev, PPDMUSBINS pUsbIns, const char *pszCaptureFilename);
    292292void vusbDevDestroy(PVUSBDEV pDev);
    293 
    294 DECLINLINE(bool) vusbDevIsRh(PVUSBDEV pDev)
    295 {
    296     return (pDev->pHub == (PVUSBROOTHUB)pDev);
    297 }
    298 
    299293bool vusbDevDoSelectConfig(PVUSBDEV dev, PCVUSBDESCCONFIGEX pCfg);
    300294void vusbDevMapEndpoint(PVUSBDEV dev, PCVUSBDESCENDPOINTEX ep);
     
    355349typedef struct VUSBROOTHUB
    356350{
    357     /** VUSB device data for the roothub @todo Remove. */
    358     VUSBDEV                     Dev;
    359351    /** Pointer to the driver instance. */
    360352    PPDMDRVINS                  pDrvIns;
     
    373365    PVUSBROOTHUBLOAD            pLoad;
    374366
     367    /** Roothub device state. */
     368    VUSBDEVICESTATE             enmState;
    375369    /** Number of ports this roothub offers. */
    376370    uint16_t                    cPorts;
     
    379373    /** Name of the roothub. Used for logging. */
    380374    char                        *pszName;
     375    /** URB pool for URBs from the roothub. */
     376    VUSBURBPOOL                 UrbPool;
    381377
    382378#if HC_ARCH_BITS == 32
     
    676672 * @returns New reference count.
    677673 * @param   pThis          The VUSB device pointer.
    678  */
    679 DECLINLINE(uint32_t) vusbDevRetain(PVUSBDEV pThis)
     674 * @param   pszWho         Caller of the retaining.
     675 */
     676DECLINLINE(uint32_t) vusbDevRetain(PVUSBDEV pThis, const char *pszWho)
    680677{
    681678    AssertPtrReturn(pThis, UINT32_MAX);
    682679
    683680    uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs);
     681    LogFlowFunc(("pThis=%p{.cRefs=%u}[%s]\n", pThis, cRefs, pszWho)); RT_NOREF(pszWho);
    684682    AssertMsg(cRefs > 1 && cRefs < _1M, ("%#x %p\n", cRefs, pThis));
    685683    return cRefs;
     
    691689 * @returns New reference count.
    692690 * @retval 0 if no onw is holding a reference anymore causing the device to be destroyed.
    693  */
    694 DECLINLINE(uint32_t) vusbDevRelease(PVUSBDEV pThis)
     691 * @param   pThis          The VUSB device pointer.
     692 * @param   pszWho         Caller of the retaining.
     693 */
     694DECLINLINE(uint32_t) vusbDevRelease(PVUSBDEV pThis, const char *pszWho)
    695695{
    696696    AssertPtrReturn(pThis, UINT32_MAX);
    697697
    698698    uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs);
     699    LogFlowFunc(("pThis=%p{.cRefs=%u}[%s]\n", pThis, cRefs, pszWho)); RT_NOREF(pszWho);
    699700    AssertMsg(cRefs < _1M, ("%#x %p\n", cRefs, pThis));
    700701    if (cRefs == 0)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette