VirtualBox

Changeset 69967 in vbox


Ignore:
Timestamp:
Dec 7, 2017 10:38:48 AM (7 years ago)
Author:
vboxsync
Message:

IPRT/dvm: Don't leak volume related stuff.

Location:
trunk/src/VBox/Runtime/common/dvm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/dvm/dvm.cpp

    r69886 r69967  
    161161 * Destroys a volume handle.
    162162 *
    163  * @param   pThis               The volume to destroy.
    164  */
    165 static void rtDvmVolumeDestroy(PRTDVMVOLUMEINTERNAL pThis)
    166 {
    167     PRTDVMINTERNAL pVolMgr = pThis->pVolMgr;
    168 
    169     AssertPtr(pVolMgr);
     163 * @param   pThis   The volume manager instance.
     164 * @param   pVol    The volume to destroy.
     165 */
     166static void rtDvmVolumeDestroy(PRTDVMINTERNAL pThis, PRTDVMVOLUMEINTERNAL pVol)
     167{
     168    AssertPtr(pThis);
     169    AssertPtr(pThis->pDvmFmtOps);
     170    Assert(pVol->pVolMgr == pThis);
    170171
    171172    /* Close the volume. */
    172     pVolMgr->pDvmFmtOps->pfnVolumeClose(pThis->hVolFmt);
    173 
    174     pThis->u32Magic = RTDVMVOLUME_MAGIC_DEAD;
    175     pThis->pVolMgr  = NULL;
    176     pThis->hVolFmt  = NIL_RTDVMVOLUMEFMT;
    177     RTMemFree(pThis);
    178 
    179     /* Release the reference of the volume manager. */
    180     RTDvmRelease(pVolMgr);
     173    pThis->pDvmFmtOps->pfnVolumeClose(pVol->hVolFmt);
     174
     175    pVol->u32Magic = RTDVMVOLUME_MAGIC_DEAD;
     176    pVol->pVolMgr  = NULL;
     177    pVol->hVolFmt  = NIL_RTDVMVOLUMEFMT;
     178    RTMemFree(pVol);
    181179}
    182180
     
    240238        AssertPtr(pThis->pDvmFmtOps);
    241239
     240        /* */
     241        PRTDVMVOLUMEINTERNAL pItNext, pIt;
     242        RTListForEachSafe(&pThis->VolumeList, pIt, pItNext, RTDVMVOLUMEINTERNAL, VolumeNode)
     243        {
     244            RTListNodeRemove(&pIt->VolumeNode);
     245            rtDvmVolumeDestroy(pThis, pIt);
     246        }
     247
    242248        /* Let the backend do it's own cleanup first. */
    243249        pThis->pDvmFmtOps->pfnClose(pThis->hVolMgrFmt);
     
    253259        pThis->DvmDisk.hVfsFile = NIL_RTVFSFILE;
    254260    }
     261
    255262    RTMemFree(pThis);
    256263}
     
    354361                {
    355362                    RTListNodeRemove(&pIt->VolumeNode);
    356                     rtDvmVolumeDestroy(pIt);
     363                    rtDvmVolumeDestroy(pThis, pIt);
    357364                }
    358365            }
  • trunk/src/VBox/Runtime/common/dvm/dvmvfs.cpp

    r69942 r69967  
    618618 */
    619619static DECLCALLBACK(int) rtDvmVfsDir_SetTimes(void *pvThis, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
    620                                              PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
     620                                              PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime)
    621621{
    622622    NOREF(pvThis); NOREF(pAccessTime); NOREF(pModificationTime); NOREF(pChangeTime); NOREF(pBirthTime);
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