Changeset 13295 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Oct 15, 2008 6:07:59 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp
r12774 r13295 1968 1968 vdRemoveImageFromList(pDisk, pImg); 1969 1969 pImg->Backend->pfnClose(pImg->pvBackendData, true); 1970 RTMemFree(pImg->pszFilename); 1971 RTMemFree(pImg); 1970 1972 pImg = pTmp; 1971 1973 } -
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r13268 r13295 890 890 891 891 /** @todo figure out what to do for unclean VMDKs. */ 892 RTMemTmpFree(pTmpGT1); 893 RTMemTmpFree(pTmpGT2); 892 894 } 893 895 … … 2979 2981 if (RT_FAILURE(rc)) 2980 2982 return vmdkError(pImage, rc, RT_SRC_POS, N_("VMDK: could not create new sparse descriptor file '%s'"), pImage->pszFilename); 2981 pImage->pszFilename = RTStrDup(pImage->pszFilename); 2983 // @todo Is there any sense in the following line I've commented out? 2984 //pImage->pszFilename = RTStrDup(pImage->pszFilename); 2982 2985 } 2983 2986 else … … 3398 3401 vmdkFileClose(pImage, &pImage->pFile, fDelete); 3399 3402 vmdkFileCheckAllClose(pImage); 3403 if (pImage->pGTCache) 3404 { 3405 RTMemFree(pImage->pGTCache); 3406 pImage->pGTCache = NULL; 3407 } 3408 if (pImage->pDescData) 3409 { 3410 RTMemFree(pImage->pDescData); 3411 pImage->pDescData = NULL; 3412 } 3400 3413 } 3401 3414 … … 3766 3779 rc = vmdkOpenImage(pImage, VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_READONLY); 3767 3780 vmdkFreeImage(pImage, false); 3781 RTMemFree(pImage); 3768 3782 3769 3783 out: … … 3907 3921 } 3908 3922 *ppBackendData = pImage; 3923 } 3924 else 3925 { 3926 RTMemFree(pImage->pDescData); 3927 RTMemFree(pImage); 3909 3928 } 3910 3929 … … 4132 4151 } 4133 4152 else 4153 { 4154 /* Shouldn't be null for separate descriptor. 4155 * There will be no access to the actual content. 4156 */ 4157 pImage->pDescData = pszOldDescName; 4134 4158 pImage->pFile = pFile; 4159 } 4135 4160 pImage->Descriptor = DescriptorCopy; 4136 4161 vmdkWriteDescriptor(pImage); … … 4139 4164 pImage->pExtents = NULL; 4140 4165 pImage->pFile = NULL; 4166 pImage->pDescData = NULL; 4141 4167 /* Re-open the image back. */ 4142 4168 pImage->pszFilename = pszOldImageName; … … 4194 4220 * not signalled as an error. After all nothing bad happens. */ 4195 4221 if (pImage) 4222 { 4196 4223 vmdkFreeImage(pImage, fDelete); 4224 RTMemFree(pImage); 4225 } 4197 4226 4198 4227 LogFlowFunc(("returns %Rrc\n", rc)); -
trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp
r13268 r13295 32 32 #include "stdlib.h" 33 33 34 #define VHD_TEST 35 #define VDI_TEST 36 #define VMDK_TEST 37 34 38 /******************************************************************************* 35 39 * Global Variables * … … 67 71 if (VBOX_FAILURE(rc)) \ 68 72 { \ 69 VD CloseAll(pVD); \73 VDDestroy(pVD); \ 70 74 return rc; \ 71 75 } \ … … 103 107 } 104 108 109 VDDestroy(pVD); 105 110 #undef CHECK 106 111 return 0; … … 123 128 if (VBOX_FAILURE(rc)) \ 124 129 { \ 125 VD CloseAll(pVD); \130 VDDestroy(pVD); \ 126 131 return rc; \ 127 132 } \ … … 154 159 } 155 160 161 VDDestroy(pVD); 156 162 #undef CHECK 157 163 return 0; … … 505 511 if (VBOX_FAILURE(rc)) \ 506 512 { \ 507 VDCloseAll(pVD); \ 513 if (pvBuf) \ 514 RTMemFree(pvBuf); \ 515 VDDestroy(pVD); \ 508 516 return rc; \ 509 517 } \ 510 518 } while (0) 519 520 void *pvBuf = RTMemAlloc(_1M); 511 521 512 522 /* Create error interface. */ … … 558 568 PSEGMENT paMergeSegments = (PSEGMENT)RTMemAllocZ(sizeof(struct Segment) * (nSegments + 1) * 3); 559 569 560 void *pvBuf = RTMemAlloc(_1M);561 562 570 RNDCTX ctx; 563 571 initializeRandomGenerator(&ctx, u32Seed); … … 600 608 VDDumpImages(pVD); 601 609 602 VDCloseAll(pVD); 610 VDDestroy(pVD); 611 if (pvBuf) 612 RTMemFree(pvBuf); 603 613 #undef CHECK 604 614 return 0; … … 625 635 if (VBOX_FAILURE(rc)) \ 626 636 { \ 627 VD CloseAll(pVD); \637 VDDestroy(pVD); \ 628 638 return rc; \ 629 639 } \ … … 681 691 RTMemFree(paSegments); 682 692 683 VD CloseAll(pVD);693 VDDestroy(pVD); 684 694 #undef CHECK 685 695 return 0; … … 700 710 if (VBOX_FAILURE(rc)) \ 701 711 { \ 702 VD CloseAll(pVD); \712 VDDestroy(pVD); \ 703 713 return rc; \ 704 714 } \ … … 722 732 CHECK("VDCopy()"); 723 733 724 VD CloseAll(pVD);734 VDDestroy(pVD); 725 735 #undef CHECK 726 736 return 0; … … 884 894 } 885 895 896 #ifdef VMDK_TEST 886 897 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 887 898 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, … … 906 917 g_cErrors++; 907 918 } 908 #if 1 919 909 920 tstVmdk(); 910 #endif 911 #if 1921 #endif /* VMDK_TEST */ 922 #ifdef VDI_TEST 912 923 rc = tstVDCreateDelete("VDI", "tmpVDCreate.vdi", 2 * _4G, 913 924 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, … … 926 937 g_cErrors++; 927 938 } 928 #endif 939 #endif /* VDI_TEST */ 940 #ifdef VMDK_TEST 929 941 rc = tstVDCreateDelete("VMDK", "tmpVDCreate.vmdk", 2 * _4G, 930 942 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, … … 959 971 g_cErrors++; 960 972 } 961 #if 1 973 #endif /* VMDK_TEST */ 974 #ifdef VHD_TEST 962 975 rc = tstVDCreateDelete("VHD", "tmpVDCreate.vhd", 2 * _4G, 963 976 VD_IMAGE_TYPE_NORMAL, VD_IMAGE_FLAGS_NONE, … … 976 989 g_cErrors++; 977 990 } 978 991 #endif /* VHD_TEST */ 992 #ifdef VDI_TEST 979 993 rc = tstVDOpenCreateWriteMerge("VDI", "tmpVDBase.vdi", "tmpVDDiff.vdi", u32Seed); 980 994 if (VBOX_FAILURE(rc)) … … 989 1003 g_cErrors++; 990 1004 } 1005 #endif /* VDI_TEST */ 1006 #ifdef VMDK_TEST 991 1007 rc = tstVDOpenCreateWriteMerge("VMDK", "tmpVDBase.vmdk", "tmpVDDiff.vmdk", u32Seed); 992 1008 if (VBOX_FAILURE(rc)) … … 1001 1017 g_cErrors++; 1002 1018 } 1003 1019 #endif /* VMDK_TEST */ 1020 #ifdef VHD_TEST 1004 1021 rc = tstVDCreateWriteOpenRead("VHD", "tmpVDCreate.vhd", u32Seed); 1005 1022 if (VBOX_FAILURE(rc)) … … 1015 1032 g_cErrors++; 1016 1033 } 1017 #endif 1034 #endif /* VHD_TEST */ 1018 1035 1019 1036 /*
Note:
See TracChangeset
for help on using the changeset viewer.