Bug 1601389 - Fix invalid-memory access in LDAP search. r+a=jorgk THUNDERBIRD_72_0b2_BUILD1 THUNDERBIRD_72_0b2_RELEASE
authorBen Campbell <benc@thunderbird.net>
Mon, 09 Dec 2019 10:44:47 +1300
changeset 37652 366d146a024904deb432103a766a1a06adf59aef
parent 37651 412e2b0c774060a9e4417587878f371855234e5d
child 37653 3d86d4ec6230969333b6c9ca031bb9d6aec34dda
push id396
push userclokep@gmail.com
push dateMon, 06 Jan 2020 23:11:57 +0000
bugs1601389
Bug 1601389 - Fix invalid-memory access in LDAP search. r+a=jorgk
ldap/xpcom/src/nsLDAPOperation.cpp
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -471,16 +471,17 @@ class SearchExtRunnable : public OpRunna
         mAttrs(aAttrs),
         mServerctls(aServerctls),
         mClientctls(aClientctls),
         mSizeLimit(aSizeLimit) {}
   virtual ~SearchExtRunnable() {
     // clean up
     ldap_controls_free(mServerctls);
     ldap_controls_free(mClientctls);
+    if (!mAttrs) return;
     // The last attr entry is null, so no need to free that.
     int numAttrs = 0;
     while (mAttrs[numAttrs]) {
       ++numAttrs;
     }
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(numAttrs, mAttrs);
   }