Bug 1019934 - don't access mRefCnt after CacheFileChunk::DispatchRelease() has been called, r=michal
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 05 Jun 2014 18:27:38 +0200
changeset 207162 2a2526aa56f44c8e8ce159e2f34d6ada20f61d20
parent 207161 d405928cb93469b7559d9599a719dae9ba670586
child 207163 12e8837e166a3f0c6ba880d1372c73aea8ec000a
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1019934
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1019934 - don't access mRefCnt after CacheFileChunk::DispatchRelease() has been called, r=michal
netwerk/cache2/CacheFileChunk.cpp
--- a/netwerk/cache2/CacheFileChunk.cpp
+++ b/netwerk/cache2/CacheFileChunk.cpp
@@ -58,23 +58,24 @@ CacheFileChunk::DispatchRelease()
 
   return true;
 }
 
 NS_IMPL_ADDREF(CacheFileChunk)
 NS_IMETHODIMP_(MozExternalRefCountType)
 CacheFileChunk::Release()
 {
+  nsrefcnt count = mRefCnt - 1;
   if (DispatchRelease()) {
     // Redispatched to the main thread.
-    return mRefCnt - 1;
+    return count;
   }
 
   NS_PRECONDITION(0 != mRefCnt, "dup release");
-  nsrefcnt count = --mRefCnt;
+  count = --mRefCnt;
   NS_LOG_RELEASE(this, count, "CacheFileChunk");
 
   if (0 == count) {
     mRefCnt = 1;
     delete (this);
     return 0;
   }