Bug 1474007: Null check to prevent crash when ipc::mscom::GetInitialInterceptorForIID fails after PublishTarget. r=aklotz
authorJames Teh <jteh@mozilla.com>
Mon, 09 Jul 2018 10:24:20 +1000
changeset 425538 391dc33b9d80ed4376713e8250966f11d9dc4ce2
parent 425537 42f32a0e75082445bf9edc7707c71f42c29c560b
child 425539 1444c96da34596c8b4f6f8484336523f19c60605
push id34258
push usertoros@mozilla.com
push dateTue, 10 Jul 2018 09:43:53 +0000
treeherdermozilla-central@0c55071115c2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaklotz
bugs1474007
milestone63.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 1474007: Null check to prevent crash when ipc::mscom::GetInitialInterceptorForIID fails after PublishTarget. r=aklotz PublishTarget calls Unlock on our LiveSetAutolock. It's possible for GetInitialInterceptorForIID to fail after this point. This will cause the failure cleanup code to run, which tries to call Unlock again. However, the previous call to Unlock set mLiveSet to null, and Unlock previously didn't handle this case. Now, unlock is a no-op (in release builds) if it's already been called. MozReview-Commit-ID: 15ffXR6nKqc
ipc/mscom/Interceptor.cpp
--- a/ipc/mscom/Interceptor.cpp
+++ b/ipc/mscom/Interceptor.cpp
@@ -99,18 +99,20 @@ public:
     if (mLiveSet) {
       mLiveSet->Unlock();
     }
   }
 
   void Unlock()
   {
     MOZ_ASSERT(mLiveSet);
-    mLiveSet->Unlock();
-    mLiveSet = nullptr;
+    if (mLiveSet) {
+      mLiveSet->Unlock();
+      mLiveSet = nullptr;
+    }
   }
 
   LiveSetAutoLock(const LiveSetAutoLock& aOther) = delete;
   LiveSetAutoLock(LiveSetAutoLock&& aOther) = delete;
   LiveSetAutoLock& operator=(const LiveSetAutoLock& aOther) = delete;
   LiveSetAutoLock& operator=(LiveSetAutoLock&& aOther) = delete;
 
 private: