- Timestamp:
- Mar 13, 2009 4:23:42 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r17775 r17847 1225 1225 RTMemTmpFree(pTmpGT); 1226 1226 1227 /* streamOptimized extents need a grain decompress buffer. */ 1228 pExtent->pvGrain = RTMemAlloc(VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain)); 1229 if (!pExtent->pvGrain) 1230 { 1231 rc = VERR_NO_MEMORY; 1232 goto out; 1233 } 1234 1227 1235 if (uLastGrainSector) 1228 1236 { … … 1305 1313 &uGTSectorLE, sizeof(uGTSectorLE), NULL); 1306 1314 if (RT_FAILURE(rc)) 1307 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new redundant grain directory entry in '%s'"), pExtent->pszFullname); 1315 { 1316 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new redundant grain directory entry in '%s'"), pExtent->pszFullname); 1317 goto out; 1318 } 1308 1319 uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t)); 1309 1320 } … … 1319 1330 &uGTSectorLE, sizeof(uGTSectorLE), NULL); 1320 1331 if (RT_FAILURE(rc)) 1321 return vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new grain directory entry in '%s'"), pExtent->pszFullname); 1332 { 1333 rc = vmdkError(pExtent->pImage, rc, RT_SRC_POS, N_("VMDK: cannot write new grain directory entry in '%s'"), pExtent->pszFullname); 1334 goto out; 1335 } 1322 1336 uOffsetSectors += VMDK_BYTE2SECTOR(pExtent->cGTEntries * sizeof(uint32_t)); 1323 1337 } 1324 1338 } 1325 1339 pExtent->cOverheadSectors = VMDK_BYTE2SECTOR(cbOverhead); 1340 1341 /* streamOptimized extents need a grain decompress buffer. */ 1342 if (pExtent->pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED) 1343 { 1344 pExtent->pvGrain = RTMemAlloc(VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain)); 1345 if (!pExtent->pvGrain) 1346 { 1347 rc = VERR_NO_MEMORY; 1348 goto out; 1349 } 1350 } 1326 1351 1327 1352 out: … … 2501 2526 } 2502 2527 2503 /* streamOptimized extents need a grain decryption buffer. */2504 if (pExtent->pImage->uImageFlags & VD_VMDK_IMAGE_FLAGS_STREAM_OPTIMIZED)2505 {2506 pExtent->pvGrain = RTMemAlloc(VMDK_SECTOR2BYTE(pExtent->cSectorsPerGrain));2507 if (!pExtent->pvGrain)2508 {2509 rc = VERR_NO_MEMORY;2510 goto out;2511 }2512 pExtent->uGrainSector = 0;2513 }2514 2515 2528 out: 2516 2529 if (RT_FAILURE(rc)) … … 2720 2733 RTStrFree((char *)(void *)pExtent->pszFullname); 2721 2734 pExtent->pszFullname = NULL; 2735 } 2736 if (pExtent->pvGrain) 2737 { 2738 RTMemFree(pExtent->pvGrain); 2739 pExtent->pvGrain = NULL; 2722 2740 } 2723 2741 }
Note:
See TracChangeset
for help on using the changeset viewer.