VirtualBox

Changeset 33478 in vbox for trunk/src


Ignore:
Timestamp:
Oct 26, 2010 8:56:38 PM (14 years ago)
Author:
vboxsync
Message:

Devices/Storage: a number of small memory leaks in error paths

Location:
trunk/src/VBox/Devices/Storage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r33271 r33478  
    711711            {
    712712                rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block failed for '%s'"), pImage->pszFilename);
     713                RTMemTmpFree(pvBuf);
    713714                goto out;
    714715            }
  • trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp

    r33182 r33478  
    922922    pImage->pBlockAllocationTable = (uint32_t *)RTMemAllocZ(pImage->cBlockAllocationTableEntries * sizeof(uint32_t));
    923923    if (!pImage->pBlockAllocationTable)
     924    {
     925        RTMemFree(pBlockAllocationTable);
    924926        return VERR_NO_MEMORY;
     927    }
    925928
    926929    for (i = 0; i < pImage->cBlockAllocationTableEntries; i++)
     
    15171520    /* Get I/O interface. */
    15181521    pImage->pInterfaceIO = VDInterfaceGet(pImage->pVDIfsImage, VDINTERFACETYPE_IOINT);
    1519     AssertPtrReturn(pImage->pInterfaceIO, VERR_INVALID_PARAMETER);
     1522    if (RT_UNLIKELY(!VALID_PTR(pImage->pInterfaceIO)))
     1523    {
     1524        RTMemFree(pImage);
     1525        return VERR_INVALID_PARAMETER;
     1526    }
    15201527    pImage->pInterfaceIOCallbacks = VDGetInterfaceIOInt(pImage->pInterfaceIO);
    1521     AssertPtrReturn(pImage->pInterfaceIOCallbacks, VERR_INVALID_PARAMETER);
     1528    if (RT_UNLIKELY(!VALID_PTR(pImage->pInterfaceIOCallbacks)))
     1529    {
     1530        RTMemFree(pImage);
     1531        return VERR_INVALID_PARAMETER;
     1532    }
    15221533
    15231534    rc = vhdCreateImage(pImage, cbSize, uImageFlags, pszComment,
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r33464 r33478  
    31993199    int rc = VINF_SUCCESS;
    32003200    PVMDKEXTENT pExtents = (PVMDKEXTENT)RTMemAllocZ(cExtents * sizeof(VMDKEXTENT));
    3201     if (pImage)
     3201    if (pExtents)
    32023202    {
    32033203        for (unsigned i = 0; i < cExtents; i++)
     
    54005400    uGDIndex = uSector / pExtent->cSectorsPerGDE;
    54015401    if (uGDIndex >= pExtent->cGDEntries)
     5402    {
     5403        RTMemFree(pGrainAlloc);
    54025404        return VERR_OUT_OF_RANGE;
     5405    }
    54035406    uGTSector = pExtent->pGD[uGDIndex];
    54045407    if (pExtent->pRGD)
     
    59005903    if (!pImage->pDescData)
    59015904    {
     5905        RTMemFree(pImage);
    59025906        rc = VERR_NO_MEMORY;
    59035907        goto out;
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