VirtualBox

Changeset 65708 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 9, 2017 4:53:09 PM (8 years ago)
Author:
vboxsync
Message:

Devices/Bus: fixed small memory leaks on destruct

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r65301 r65708  
    13891389
    13901390/**
     1391 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     1392 */
     1393static DECLCALLBACK(int)   pciR3Destruct(PPDMDEVINS pDevIns)
     1394{
     1395    PDEVPCIROOT pGlobals = PDMINS_2_DATA(pDevIns, PDEVPCIROOT);
     1396    if (pGlobals->PciBus.papBridgesR3)
     1397    {
     1398        PDMDevHlpMMHeapFree(pDevIns, pGlobals->PciBus.papBridgesR3);
     1399        pGlobals->PciBus.papBridgesR3 = NULL;
     1400    }
     1401    return VINF_SUCCESS;
     1402}
     1403
     1404
     1405/**
    13911406 * The device registration structure.
    13921407 */
     
    14141429    pciR3Construct,
    14151430    /* pfnDestruct */
    1416     NULL,
     1431    pciR3Destruct,
    14171432    /* pfnRelocate */
    14181433    devpciR3RootRelocate,
     
    17041719
    17051720/**
     1721 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     1722 */
     1723static DECLCALLBACK(int)   pcibridgeR3Destruct(PPDMDEVINS pDevIns)
     1724{
     1725    PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS);
     1726    if (pBus->papBridgesR3)
     1727    {
     1728        PDMDevHlpMMHeapFree(pDevIns, pBus->papBridgesR3);
     1729        pBus->papBridgesR3 = NULL;
     1730    }
     1731    return VINF_SUCCESS;
     1732}
     1733
     1734
     1735/**
    17061736 * The device registration structure
    17071737 * for the PCI-to-PCI bridge.
     
    17301760    pcibridgeR3Construct,
    17311761    /* pfnDestruct */
    1732     NULL,
     1762    pcibridgeR3Destruct,
    17331763    /* pfnRelocate */
    17341764    devpciR3BusRelocate,
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r65648 r65708  
    29452945
    29462946
    2947 
     2947/**
     2948 * @interface_method_impl{PDMDEVREG,pfnConstruct}
     2949 */
    29482950static DECLCALLBACK(int) ich9pciConstruct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE  pCfg)
    29492951{
     
    31453147}
    31463148
     3149
     3150/**
     3151 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     3152 */
     3153static DECLCALLBACK(int) ich9pciDestruct(PPDMDEVINS pDevIns)
     3154{
     3155    PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT);
     3156    if (pPciRoot->PciBus.papBridgesR3)
     3157    {
     3158        PDMDevHlpMMHeapFree(pDevIns, pPciRoot->PciBus.papBridgesR3);
     3159        pPciRoot->PciBus.papBridgesR3 = NULL;
     3160    }
     3161    return VINF_SUCCESS;
     3162}
     3163
     3164
    31473165static void ich9pciResetDevice(PPDMPCIDEV pDev)
    31483166{
     
    33823400
    33833401/**
     3402 * @interface_method_impl{PDMDEVREG,pfnDestruct}
     3403 */
     3404static DECLCALLBACK(int) ich9pcibridgeDestruct(PPDMDEVINS pDevIns)
     3405{
     3406    PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS);
     3407    if (pBus->papBridgesR3)
     3408    {
     3409        PDMDevHlpMMHeapFree(pDevIns, pBus->papBridgesR3);
     3410        pBus->papBridgesR3 = NULL;
     3411    }
     3412    return VINF_SUCCESS;
     3413}
     3414
     3415/**
    33843416 * @copydoc FNPDMDEVRESET
    33853417 */
     
    34293461    ich9pciConstruct,
    34303462    /* pfnDestruct */
    3431     NULL,
     3463    ich9pciDestruct,
    34323464    /* pfnRelocate */
    34333465    devpciR3RootRelocate,
     
    34853517    ich9pcibridgeConstruct,
    34863518    /* pfnDestruct */
    3487     NULL,
     3519    ich9pcibridgeDestruct,
    34883520    /* pfnRelocate */
    34893521    devpciR3BusRelocate,
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