Bug 1063829 - Add kungFuDeathGrip for nsLDAPOperation r=rkent, a=rkent
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 20 Feb 2015 10:03:26 -0800
changeset 20144 e26fc5019f843040c3c5dc197af81e6c4c8dd751
parent 20143 cb8dab139590af3c7436f573b9f8fa74a5a67c95
child 20145 5088537f44509037d261be757a0d5c9b289dec23
push id44
push userkent@caspia.com
push dateThu, 26 Mar 2015 21:07:24 +0000
treeherdercomm-esr31@e26fc5019f84 [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());