VirtualBox

Changeset 2944 in kBuild


Ignore:
Timestamp:
Sep 20, 2016 1:46:09 AM (8 years ago)
Author:
bird
Message:

kFsCache: Finally tracked down the heap corruption bug in the directory refreshing code. Added kFsCacheObjReleaseTagged for debugging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/nt/kFsCache.c

    r2940 r2944  
    11141114    if (cOldChildren > 0)
    11151115    {
    1116         KU32 const  iNextOldChild = K_MIN(pDirRePop->iNextOldChild, cOldChildren);
     1116        KU32 const  iNextOldChild = K_MIN(pDirRePop->iNextOldChild, cOldChildren - 1);
    11171117        PKFSOBJ     pCur          = pDirRePop->papOldChildren[iNextOldChild];
    11181118
     
    36473647 * @param   pCache              The cache.
    36483648 * @param   pObj                The object.
    3649  */
    3650 KU32 kFsCacheObjDestroy(PKFSCACHE pCache, PKFSOBJ pObj)
     3649 * @param   pszWhere            Where it was released from.
     3650 */
     3651KU32 kFsCacheObjDestroy(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere)
    36513652{
    36523653    kHlpAssert(pObj->cRefs == 0);
     
    36543655    kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC);
    36553656
    3656     KFSCACHE_LOG(("Destroying %s/%s, type=%d\n", pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType));
     3657    KFSCACHE_LOG(("Destroying %s/%s, type=%d, pObj=%p, pszWhere=%s\n",
     3658                  pObj->pParent ? pObj->pParent->Obj.pszName : "", pObj->pszName, pObj->bObjType, pObj, pszWhere));
    36573659    if (pObj->abUnused[1] != 0)
    36583660    {
     
    37473749 * @param   pObj                The object.
    37483750 */
     3751#undef kFsCacheObjRelease
    37493752KU32 kFsCacheObjRelease(PKFSCACHE pCache, PKFSOBJ pObj)
    37503753{
     
    37583761        if (cRefs)
    37593762            return cRefs;
    3760         return kFsCacheObjDestroy(pCache, pObj);
     3763        return kFsCacheObjDestroy(pCache, pObj, "kFsCacheObjRelease");
     3764    }
     3765    return 0;
     3766}
     3767
     3768
     3769/**
     3770 * Debug version of kFsCacheObjRelease
     3771 *
     3772 * @returns New reference count.
     3773 * @param   pCache              The cache.
     3774 * @param   pObj                The object.
     3775 * @param   pszWhere            Where it's invoked from.
     3776 */
     3777KU32 kFsCacheObjReleaseTagged(PKFSCACHE pCache, PKFSOBJ pObj, const char *pszWhere)
     3778{
     3779    if (pObj)
     3780    {
     3781        KU32 cRefs;
     3782        kHlpAssert(pCache->u32Magic == KFSCACHE_MAGIC);
     3783        kHlpAssert(pObj->u32Magic == KFSOBJ_MAGIC);
     3784
     3785        cRefs = --pObj->cRefs;
     3786        if (cRefs)
     3787            return cRefs;
     3788        return kFsCacheObjDestroy(pCache, pObj, pszWhere);
    37613789    }
    37623790    return 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