VirtualBox

Changeset 57054 in vbox


Ignore:
Timestamp:
Jul 22, 2015 11:38:49 AM (10 years ago)
Author:
vboxsync
Message:

Devices/Audio/DrvAudio.cpp: Fix cleanup logic, as having it in the destruct callback is too late (it uses the driver below, which is already destructed at this point). Kind of a use after free, but for VM poweroff the memory is freed later (it crashed when constructing failed as then the driver below is freed before destructing this one).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvAudio.cpp

    r56648 r57054  
    17611761static DECLCALLBACK(void) drvAudioPowerOff(PPDMDRVINS pDrvIns)
    17621762{
    1763     drvAudioStateHandler(pDrvIns, PDMAUDIOSTREAMCMD_DISABLE);
    1764 }
    1765 
    1766 /**
    1767  * Destructs an audio driver instance.
    1768  *
    1769  * Most VM resources are freed by the VM. This callback is provided so that any non-VM
    1770  * resources can be freed correctly.
    1771  *
    1772  * @param   pDrvIns     The driver instance data.
    1773  */
    1774 static DECLCALLBACK(void) drvAudioDestruct(PPDMDRVINS pDrvIns)
    1775 {
    17761763    LogFlowFuncEnter();
    17771764    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
    17781765
    17791766    PDRVAUDIO pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIO);
     1767
     1768    if (!pThis->pHostDrvAudio)
     1769        return;
    17801770
    17811771    /* Tear down all host output streams. */
     
    19171907    drvAudioConstruct,
    19181908    /* pfnDestruct */
    1919     drvAudioDestruct,
     1909    NULL,
    19201910    /* pfnRelocate */
    19211911    NULL,
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