Index: trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 48115)
+++ trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp	(revision 48117)
@@ -1630,4 +1630,5 @@
     void *pvMfBuf = 0;
     void *pvCertBuf = 0;
+    Utf8Str OVFfilename;
 
     writeLock.release();
@@ -1668,5 +1669,5 @@
         if (RT_FAILURE(vrc))
             throw setError(VBOX_E_IPRT_ERROR,
-                           tr("Getting the current file within the archive failed (%Rrc)"), vrc);
+                           tr("Getting the OVF file within the archive failed (%Rrc)"), vrc);
         else
         {
@@ -1679,4 +1680,12 @@
             }
         }
+
+        /* save original OVF filename */
+        OVFfilename = pszFilename;
+        size_t cbMfSize = 0;
+        size_t cbCertSize = 0;
+        Utf8Str strMfFile = (Utf8Str(pszFilename)).stripExt().append(".mf");
+        Utf8Str strCertFile = (Utf8Str(pszFilename)).stripExt().append(".cert");
+
         /* Skip the OVF file, cause this was read in IAppliance::Read already. */
         vrc = RTTarSeekNextFile(tar);
@@ -1704,6 +1713,4 @@
         pStorage->fCreateDigest = true;
 
-        size_t cbMfSize = 0;
-        Utf8Str strMfFile = Utf8Str(pszFilename).stripExt().append(".mf");
         /* Create the import stack for the rollback on errors. */
         ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress);
@@ -1729,20 +1736,17 @@
          */
         vrc = RTTarCurrentFile(tar, &pszFilename);
-        if (RT_FAILURE(vrc))
-            throw setError(VBOX_E_IPRT_ERROR,
-                           tr("Getting the current file within the archive failed (%Rrc)"), vrc);
-
-        size_t cbCertSize = 0;
-        Utf8Str strCertFile = Utf8Str(pszFilename).stripExt().append(".cert");
-        if (pvMfBuf)
-        {
-            if (strCertFile.compare(pszFilename) == 0)
-            {
-                rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
-                if (FAILED(rc)) throw rc;
-
-                if (pvCertBuf)
+        if (RT_SUCCESS(vrc))
+        {
+            if (pvMfBuf)
+            {
+                if (strCertFile.compare(pszFilename) == 0)
                 {
-                /* verify the certificate */
+                    rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
+                    if (FAILED(rc)) throw rc;
+
+                    if (pvCertBuf)
+                    {
+                    /* verify the certificate */
+                    }
                 }
             }
@@ -1761,6 +1765,5 @@
             {
                 /* Add the ovf file to the digest list. */
-                stack.llSrcDisksDigest.push_front(STRPAIR(Utf8Str(pszFilename).stripExt().append(".ovf"),
-                                                  m->strOVFSHADigest));
+                stack.llSrcDisksDigest.push_front(STRPAIR(OVFfilename, m->strOVFSHADigest));
                 rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
                 if (FAILED(rc)) throw rc;
@@ -1772,16 +1775,15 @@
 
                 vrc = RTTarCurrentFile(tar, &pszFilename);
-                if (RT_FAILURE(vrc))
-                    throw setError(VBOX_E_IPRT_ERROR,
-                                   tr("Getting the current file within the archive failed (%Rrc)"), vrc);
-
-                if (strCertFile.compare(pszFilename) == 0)
+                if (RT_SUCCESS(vrc))
                 {
-                    rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
-                    if (FAILED(rc)) throw rc;
-
-                    if (pvCertBuf)
+                    if (strCertFile.compare(pszFilename) == 0)
                     {
-                    /* verify the certificate */
+                        rc = readTarFileToBuf(tar, strCertFile, &pvCertBuf, &cbCertSize, false, pCallbacks, pStorage);
+                        if (FAILED(rc)) throw rc;
+
+                        if (pvCertBuf)
+                        {
+                        /* verify the certificate */
+                        }
                     }
                 }
@@ -2382,5 +2384,4 @@
             if (strTrgFormat.compare("RAW", Utf8Str::CaseInsensitive) == 0)
             {
-                void *pvTmpBuf = 0;
                 try
                 {
@@ -2405,5 +2406,5 @@
                         /* Calculating SHA digest for ISO file while copying one */
                         vrc = copyFileAndCalcShaDigest(strSrcFilePath.c_str(),
-                                                        strTargetPath->c_str(),
+                                                       strTargetPath->c_str(),
                                                        pCallbacks,
                                                        pRealUsedStorage);
@@ -2417,11 +2418,6 @@
                 catch (HRESULT arc)
                 {
-                    if (pvTmpBuf)
-                        RTMemFree(pvTmpBuf);
                     throw;
                 }
-
-                if (pvTmpBuf)
-                    RTMemFree(pvTmpBuf);
 
                 /* Advance to the next operation. */
