Bug 522141: Don't crash on fasl close
authorTaras Glek <tglek@mozilla.com>
Fri, 16 Oct 2009 17:17:55 -0700
changeset 33972 1c4fed24fc4c0f0a0288ce92d2345fae36a79331
parent 33971 dbe3efa8ff5a5b9c589b42f7aa84d962d3426f66
child 33973 afd110289f5d5014b6dd3749c49fb326c66fb612
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs522141
milestone1.9.3a1pre
Bug 522141: Don't crash on fasl close
xpcom/io/nsFastLoadFile.cpp
--- a/xpcom/io/nsFastLoadFile.cpp
+++ b/xpcom/io/nsFastLoadFile.cpp
@@ -919,16 +919,20 @@ nsFastLoadFileReader::Close()
             PR_MemUnmap(mFileData, mFileLen);
         mFileData = nsnull;
         if (mFileMap)
             PR_CloseFileMap(mFileMap);
         mFileMap = nsnull;
         PR_Close(mFd);
         mFd = nsnull;
     }
+    
+    if (!mFooter.mObjectMap)
+        return NS_OK;
+
     for (PRUint32 i = 0, n = mFooter.mNumSharpObjects; i < n; i++) {
         nsObjectMapEntry* entry = &mFooter.mObjectMap[i];
         entry->mReadObject = nsnull;
     }
     mFooter.mNumSharpObjects = 0;
 
     return NS_OK;
 }