Changeset 13340 in vbox
- Timestamp:
- Oct 16, 2008 1:16:33 PM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r12762 r13340 802 802 } 803 803 804 static void vhdFreeImageMemory(PVHDIMAGE pImage) 805 { 806 if (pImage->pszParentFilename) 807 { 808 RTStrFree(pImage->pszParentFilename); 809 pImage->pszParentFilename = NULL; 810 } 811 if (pImage->pBlockAllocationTable) 812 { 813 RTMemFree(pImage->pBlockAllocationTable); 814 pImage->pBlockAllocationTable = NULL; 815 } 816 if (pImage->pu8Bitmap) 817 { 818 RTMemFree(pImage->pu8Bitmap); 819 pImage->pu8Bitmap = NULL; 820 } 821 RTMemFree(pImage); 822 } 823 804 824 static int vhdFreeImage(PVHDIMAGE pImage) 805 825 { … … 811 831 vhdFlush(pImage); 812 832 RTFileClose(pImage->File); 813 RTMemFree(pImage);833 vhdFreeImageMemory(pImage); 814 834 } 815 835 … … 826 846 * not signalled as an error. After all nothing bad happens. */ 827 847 if (pImage) { 828 if (pImage->pu8Bitmap)829 {830 RTMemFree(pImage->pu8Bitmap);831 pImage->pu8Bitmap = NULL;832 }833 848 if (fDelete) 834 849 { … … 836 851 RTFileClose(pImage->File); 837 852 RTFileDelete(pImage->pszFilename); 853 vhdFreeImageMemory(pImage); 838 854 } 839 855 else 840 856 rc = vhdFreeImage(pImage); 841 if (pImage->pszParentFilename)842 RTStrFree(pImage->pszParentFilename);843 857 } 844 858 … … 898 912 uint32_t cSectors = 0; 899 913 uint32_t iBitmap = cBATEntryIndex / 8; /* Byte in the block bitmap. */ 914 Assert(iBitmap < pImage->cbDataBlockBitmap); 900 915 901 916 /* … … 1109 1124 if (pImage->fDynHdrNeedsUpdate) 1110 1125 vhdDynamicHeaderUpdate(pImage); 1126 RTMemFree(pBlockAllocationTableToWrite); 1111 1127 } 1112 1128 -
trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp
r13295 r13340 635 635 if (VBOX_FAILURE(rc)) \ 636 636 { \ 637 if (pvBuf) \ 638 RTMemFree(pvBuf); \ 637 639 VDDestroy(pVD); \ 638 640 return rc; \ 639 641 } \ 640 642 } while (0) 643 644 void *pvBuf = RTMemAlloc(_1M); 641 645 642 646 /* Create error interface. */ … … 672 676 PSEGMENT paSegments = (PSEGMENT)RTMemAllocZ(sizeof(struct Segment) * (nSegments + 1)); 673 677 674 void *pvBuf = RTMemAlloc(_1M);675 676 678 RNDCTX ctx; 677 679 initializeRandomGenerator(&ctx, u32Seed); … … 692 694 693 695 VDDestroy(pVD); 696 if (pvBuf) 697 RTMemFree(pvBuf); 694 698 #undef CHECK 695 699 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.