VirtualBox

Changeset 15842 in vbox for trunk/src/VBox/Devices/Network


Ignore:
Timestamp:
Jan 7, 2009 4:41:48 PM (16 years ago)
Author:
vboxsync
Message:

SrvIntNetR0: Rewrote r41325 so it fixes the problem without leaking memory.

Location:
trunk/src/VBox/Devices/Network
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/SrvIntNetR0.cpp

    r15757 r15842  
    547547 * by handle lookup/freeing.
    548548 *
    549  * @returns false in case the pIf was deleted as a result of this call, false otherwise
     549 * @returns true if destroyed, false if not.
    550550 * @param   pIf                 The interface instance.
    551551 * @param   pSession            The current session.
     
    555555    int rc = SUPR0ObjRelease(pIf->pvObj, pSession);
    556556    AssertRC(rc);
    557     if(!pIf->pvObj)
    558     {
    559         RTMemFree(pIf);
    560         return false;
    561     }
    562     return true;
     557    return rc == VINF_OBJECT_DESTROYED;
    563558}
    564559
     
    30533048        if (!pIf->fDestroying)
    30543049        {
    3055             if(!intnetR0IfRelease(pIf, pSession))
     3050            if (!intnetR0IfRelease(pIf, pSession))
    30563051                rc = VERR_SEM_DESTROYED;
    30573052        }
     
    31133108    RTSemEventSignal(pIf->Event);
    31143109
     3110    void *pvObj = pIf->pvObj;
    31153111    intnetR0IfRelease(pIf, pSession); /* (RTHandleTableFreeWithCtx) */
    31163112
    3117     intnetR0IfRelease(pIf, pSession);
    3118 
    3119     int rc = VINF_SUCCESS;
     3113    int rc = SUPR0ObjRelease(pvObj, pSession);
    31203114    LogFlow(("INTNETR0IfClose: returns %Rrc\n", rc));
    31213115    return rc;
     
    31723166    }
    31733167
    3174      /*
     3168    /*
    31753169     * If we've got a network deactivate and unlink ourselves from it.
    31763170     * Because of cleanup order we might be an orphan now.
     
    32653259     */
    32663260    pIf->pvObj = NULL;
    3267     /*
    3268      * we are freeing it in
    3269      * intnetR0IfRelease
    3270      * RTMemFree(pIf);
    3271      */
     3261    RTMemFree(pIf);
    32723262}
    32733263
     
    33963386                    }
    33973387
    3398                     intnetR0IfRelease(pIf, pSession);
     3388                    SUPR0ObjRelease(pIf->pvObj, pSession);
    33993389                    LogFlow(("intnetR0NetworkCreateIf: returns %Rrc\n", rc));
    34003390                    return rc;
  • trunk/src/VBox/Devices/Network/testcase/tstIntNetR0.cpp

    r15505 r15842  
    161161        pRef->pfnDestructor(pRef, pRef->pvUser1, pRef->pvUser2);
    162162        RTMemFree(pRef);
     163        return VINF_OBJECT_DESTROYED;
    163164    }
    164165    return VINF_SUCCESS;
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