Bug 1063829 - Add kungFuDeathGrip for nsLDAPOperation r=rkent, a=rkent BETA_BASE_20150223
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 20 Feb 2015 10:03:26 -0800
changeset 25717 fae7fa18f2339784b871212e889bf66f8d8f5829
parent 25716 13f0f38594621fa463104400bddb7b760c603694
child 25718 c6bacc17c3966c40003605cd6124677aab6adacd
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent, rkent
bugs1063829
Bug 1063829 - Add kungFuDeathGrip for nsLDAPOperation r=rkent, a=rkent
ldap/xpcom/src/nsLDAPOperation.cpp
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -278,16 +278,20 @@ nsLDAPOperation::SimpleBind(const nsACSt
     rv = connection->GetBindName(bindName);
     if (NS_FAILED(rv))
         return rv;
 
     PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
            ("nsLDAPOperation::SimpleBind(): called; bindName = '%s'; ",
             bindName.get()));
 
+    // this (nsLDAPOperation) may be released by RemovePendingOperation()
+    // See https://bugzilla.mozilla.org/show_bug.cgi?id=1063829.
+    nsRefPtr<nsLDAPOperation> kungFuDeathGrip = this;
+
     // If this is a second try at binding, remove the operation from pending ops
     // because msg id has changed...
     if (originalMsgID)
       connection->RemovePendingOperation(originalMsgID);
 
     mMsgID = ldap_simple_bind(mConnectionHandle, bindName.get(),
                               mSavePassword.get());