VirtualBox

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


Ignore:
Timestamp:
Apr 15, 2008 7:38:29 AM (17 years ago)
Author:
vboxsync
Message:

VBoxHDD-new: Fix incorrect error handling (causing a crash) and an incorrect assertion triggering the error handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r7900 r7967  
    833833 *
    834834 * @returns VBox status code.
    835  *          VINF_SUCCESS if a plugin was found. 
     835 *          VINF_SUCCESS if a plugin was found.
    836836 *                       ppszFormat contains the string which can be used as backend name.
    837837 *          VERR_NOT_SUPPORTED if no backend was found.
     
    11901190    if (VBOX_FAILURE(rc))
    11911191    {
    1192         if (pImage->hPlugin != NIL_RTLDRMOD)
    1193             RTLdrClose(pImage->hPlugin);
    1194 
    11951192        if (pImage)
    11961193        {
     1194            if (pImage->hPlugin != NIL_RTLDRMOD)
     1195                RTLdrClose(pImage->hPlugin);
     1196
    11971197            if (pImage->pszFilename)
    11981198                RTStrFree(pImage->pszFilename);
     
    12731273        /* The LCHS geometry fields may be 0 to leave it to later autodetection. */
    12741274        AssertMsgBreak(   VALID_PTR(pLCHSGeometry)
    1275                        && pLCHSGeometry->cCylinders <= 16383
    1276                        && pLCHSGeometry->cHeads <= 16
     1275                       && pLCHSGeometry->cCylinders <= 1024
     1276                       && pLCHSGeometry->cHeads <= 255
    12771277                       && pLCHSGeometry->cSectors <= 63,
    12781278                       ("pLCHSGeometry=%#p LCHS=%u/%u/%u\n", pLCHSGeometry,
     
    13901390    if (VBOX_FAILURE(rc))
    13911391    {
    1392         if (pImage->hPlugin != NIL_RTLDRMOD)
    1393             RTLdrClose(pImage->hPlugin);
    1394 
    13951392        if (pImage)
    13961393        {
     1394            if (pImage->hPlugin != NIL_RTLDRMOD)
     1395                RTLdrClose(pImage->hPlugin);
     1396
    13971397            if (pImage->pszFilename)
    13981398                RTStrFree(pImage->pszFilename);
     
    18211821                       rc = VERR_INVALID_PARAMETER);
    18221822        AssertMsg(pDiskFrom->u32Signature == VBOXHDDDISK_SIGNATURE,
    1823                   ("u32Signature=%08x\n", pDiskFrom->u32Signature)); 
     1823                  ("u32Signature=%08x\n", pDiskFrom->u32Signature));
    18241824
    18251825        PVDIMAGE pImageFrom = vdGetImageByNumber(pDiskFrom, nImage);
     
    18281828                       rc = VERR_INVALID_PARAMETER);
    18291829        AssertMsg(pDiskTo->u32Signature == VBOXHDDDISK_SIGNATURE,
    1830                   ("u32Signature=%08x\n", pDiskTo->u32Signature)); 
     1830                  ("u32Signature=%08x\n", pDiskTo->u32Signature));
    18311831
    18321832        /* If the containers are equal and the backend is the same, rename the image. */
     
    18991899            break;
    19001900        }
    1901        
     1901
    19021902        if (cbSize == 0)
    19031903            cbSize = cbSizeFrom;
     
    19071907        if (VBOX_FAILURE(rc))
    19081908            break;
    1909      
     1909
    19101910        /* @todo Get this from the source image. */
    19111911        PDMMEDIAGEOMETRY PCHSGeometryFrom = {0, 0, 0};
    19121912        PDMMEDIAGEOMETRY LCHSGeometryFrom = {0, 0, 0};
    1913        
     1913
    19141914        unsigned uOpenFlagsFrom;
    19151915        rc = VDGetOpenFlags(pDiskFrom, nImage, &uOpenFlagsFrom);
     
    19461946        uint64_t uOffset = 0;
    19471947        uint64_t cbRemaining = cbSize;
    1948        
     1948
    19491949        do
    19501950        {
     
    20112011        if (pImageTo->pszFilename)
    20122012            RTStrFree(pImageTo->pszFilename);
    2013        
     2013
    20142014        RTMemFree(pImageTo);
    20152015    }
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