VirtualBox

Changeset 38490 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 18, 2011 12:22:02 PM (13 years ago)
Author:
vboxsync
Message:

VD: fixed regression of r73520 (Interface cleanup) for ovf file import

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r38469 r38490  
    814814    HRESULT rc = S_OK;
    815815
    816     PVDINTERFACEIO pSha1Callbacks = 0;
    817     PVDINTERFACEIO pFileCallbacks = 0;
     816    PVDINTERFACEIO pSha1Io = 0;
     817    PVDINTERFACEIO pFileIo = 0;
    818818    do
    819819    {
    820         pSha1Callbacks = Sha1CreateInterface();
    821         if (!pSha1Callbacks)
     820        pSha1Io = Sha1CreateInterface();
     821        if (!pSha1Io)
    822822        {
    823823            rc = E_OUTOFMEMORY;
    824824            break;
    825825        }
    826         pFileCallbacks = FileCreateInterface();
    827         if (!pFileCallbacks)
     826        pFileIo = FileCreateInterface();
     827        if (!pFileIo)
    828828        {
    829829            rc = E_OUTOFMEMORY;
    830830            break;
    831831        }
    832         VDINTERFACE VDInterfaceIO;
    833832        SHA1STORAGE storage;
    834833        RT_ZERO(storage);
    835         int vrc = VDInterfaceAdd(&VDInterfaceIO, "Appliance::IOFile",
    836                                  VDINTERFACETYPE_IO, pFileCallbacks,
    837                                  0, &storage.pVDImageIfaces);
     834        int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile",
     835                                 VDINTERFACETYPE_IO, pFileIo, sizeof(VDINTERFACEIO),
     836                                 &storage.pVDImageIfaces);
    838837        if (RT_FAILURE(vrc))
    839838        {
     
    842841        }
    843842
    844         rc = readFSImpl(pTask, pTask->locInfo.strPath, pSha1Callbacks, &storage);
     843        rc = readFSImpl(pTask, pTask->locInfo.strPath, pSha1Io, &storage);
    845844    }while(0);
    846845
    847846    /* Cleanup */
    848     if (pSha1Callbacks)
    849         RTMemFree(pSha1Callbacks);
    850     if (pFileCallbacks)
    851         RTMemFree(pFileCallbacks);
     847    if (pSha1Io)
     848        RTMemFree(pSha1Io);
     849    if (pFileIo)
     850        RTMemFree(pFileIo);
    852851
    853852    LogFlowFunc(("rc=%Rhrc\n", rc));
     
    12301229    HRESULT rc = S_OK;
    12311230
    1232     PVDINTERFACEIO pSha1Callbacks = 0;
    1233     PVDINTERFACEIO pFileCallbacks = 0;
     1231    PVDINTERFACEIO pSha1Io = 0;
     1232    PVDINTERFACEIO pFileIo = 0;
    12341233    void *pvMfBuf = 0;
    12351234    writeLock.release();
     
    12371236    {
    12381237        /* Create the necessary file access interfaces. */
    1239         pSha1Callbacks = Sha1CreateInterface();
    1240         if (!pSha1Callbacks)
     1238        pSha1Io = Sha1CreateInterface();
     1239        if (!pSha1Io)
    12411240            throw E_OUTOFMEMORY;
    1242         pFileCallbacks = FileCreateInterface();
    1243         if (!pFileCallbacks)
     1241        pFileIo = FileCreateInterface();
     1242        if (!pFileIo)
    12441243            throw E_OUTOFMEMORY;
    12451244
    1246         VDINTERFACE VDInterfaceIO;
    12471245        SHA1STORAGE storage;
    12481246        RT_ZERO(storage);
    12491247        storage.fCreateDigest = true;
    1250         int vrc = VDInterfaceAdd(&VDInterfaceIO, "Appliance::IOFile",
    1251                                  VDINTERFACETYPE_IO, pFileCallbacks,
    1252                                  0, &storage.pVDImageIfaces);
     1248        int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile",
     1249                                 VDINTERFACETYPE_IO, pFileIo, sizeof(VDINTERFACEIO),
     1250                                 &storage.pVDImageIfaces);
    12531251        if (RT_FAILURE(vrc))
    12541252            throw E_FAIL;
     
    12611259        storage.fCreateDigest = RTFileExists(strMfFile.c_str());
    12621260        /* Now import the appliance. */
    1263         importMachines(stack, pSha1Callbacks, &storage);
     1261        importMachines(stack, pSha1Io, &storage);
    12641262        /* Read & verify the manifest file, if there is one. */
    12651263        if (storage.fCreateDigest)
     
    12671265            /* Add the ovf file to the digest list. */
    12681266            stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHA1Digest));
    1269             rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pSha1Callbacks, &storage);
     1267            rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pSha1Io, &storage);
    12701268            if (FAILED(rc)) throw rc;
    12711269            rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
     
    12821280    if (pvMfBuf)
    12831281        RTMemFree(pvMfBuf);
    1284     if (pSha1Callbacks)
    1285         RTMemFree(pSha1Callbacks);
    1286     if (pFileCallbacks)
    1287         RTMemFree(pFileCallbacks);
     1282    if (pSha1Io)
     1283        RTMemFree(pSha1Io);
     1284    if (pFileIo)
     1285        RTMemFree(pFileIo);
    12881286
    12891287    LogFlowFunc(("rc=%Rhrc\n", rc));
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