Bug 1150176: Remove now-dead allocators from comm-central to help reopen a CLOSED TREE, r=rkent
authorJoshua Cranmer <Pidgeot18@gmail.com>
Thu, 02 Apr 2015 12:18:38 -0500
changeset 22388 76d3068017576925b331610a016ad39b85a2c147
parent 22387 ce064c0d550b56f501ad16dd7d1109a04e8ea30d
child 22389 1cc7a71a04355c949421c3789386c48af37f5f3b
push id1420
push usermbanner@mozilla.com
push dateMon, 29 Jun 2015 20:47:24 +0000
treeherdercomm-beta@b3db00bb24e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent
bugs1150176
Bug 1150176: Remove now-dead allocators from comm-central to help reopen a CLOSED TREE, r=rkent
calendar/base/backend/libical/calICSService.cpp
calendar/base/backend/libical/calRecurrenceRule.cpp
ldap/xpcom/src/nsLDAPBERValue.cpp
ldap/xpcom/src/nsLDAPMessage.cpp
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPSecurityGlue.cpp
ldap/xpcom/src/nsLDAPService.cpp
mailnews/addrbook/src/nsAbLDAPDirectory.cpp
mailnews/addrbook/src/nsAbLDIFService.cpp
mailnews/addrbook/src/nsAbUtils.h
mailnews/addrbook/src/nsAbView.cpp
mailnews/addrbook/src/nsDirPrefs.cpp
mailnews/base/search/src/nsMsgFilterList.cpp
mailnews/base/search/src/nsMsgSearchAdapter.cpp
mailnews/base/search/src/nsMsgSearchNews.cpp
mailnews/base/src/nsMessenger.cpp
mailnews/base/src/nsMsgDBView.cpp
mailnews/base/util/nsMsgDBFolder.cpp
mailnews/base/util/nsMsgKeySet.cpp
mailnews/base/util/nsMsgProtocol.cpp
mailnews/base/util/nsMsgUtils.cpp
mailnews/compose/src/nsMsgCompose.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsMsgSend.cpp
mailnews/db/msgdb/public/nsIMsgDatabase.idl
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
mailnews/extensions/smime/src/nsSMimeJSHelper.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapUrl.cpp
mailnews/import/outlook/src/MapiApi.cpp
mailnews/local/src/nsLocalMailFolder.cpp
mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
mailnews/mime/src/mimehdrs.cpp
mailnews/mime/src/mimemoz2.cpp
mailnews/mime/src/modlmime.h
--- a/calendar/base/backend/libical/calICSService.cpp
+++ b/calendar/base/backend/libical/calICSService.cpp
@@ -524,17 +524,17 @@ calIcalComponent::GetReferencedTimezones
     uint32_t const count = mReferencedTimezones.Count();
     if (count == 0) {
         *aCount = 0;
         *aTimezones = nullptr;
         return NS_OK;
     }
 
     calITimezone ** const timezones = static_cast<calITimezone **>(
-        nsMemory::Alloc(sizeof(calITimezone *) * count));
+        moz_xmalloc(sizeof(calITimezone *) * count));
     CAL_ENSURE_MEMORY(timezones);
     // tzptr will get used as an iterator by the enumerator function
     calITimezone ** tzptr = timezones;
     mReferencedTimezones.EnumerateRead(TimezoneHashToTimezoneArray, &tzptr);
 
     *aTimezones = timezones;
     *aCount = count;
     return NS_OK;
@@ -1104,17 +1104,17 @@ calIcalComponent::AddSubcomponent(calIIc
             rv = vcal->AddTimezoneReference(timezones[i]);
             if (NS_FAILED(rv))
                 failed = true;
         }
 
         NS_RELEASE(timezones[i]);
     }
 
-    nsMemory::Free(timezones);
+    free(timezones);
 
     if (failed)
         return rv;
 
     if (ical->mParent) {
         ical->mComponent = icalcomponent_new_clone(ical->mComponent);
     }
     ical->mParent = this;
--- a/calendar/base/backend/libical/calRecurrenceRule.cpp
+++ b/calendar/base/backend/libical/calRecurrenceRule.cpp
@@ -496,17 +496,17 @@ calRecurrenceRule::GetOccurrences(calIDa
         if (aMaxCount && aMaxCount <= count)
             break;
     }
 
     icalrecur_iterator_free(recur_iter);
 
     if (count) {
         calIDateTime ** const dateArray =
-            static_cast<calIDateTime **>(nsMemory::Alloc(sizeof(calIDateTime*) * count));
+            static_cast<calIDateTime **>(moz_xmalloc(sizeof(calIDateTime*) * count));
         CAL_ENSURE_MEMORY(dateArray);
         for (uint32_t i = 0; i < count; ++i) {
             NS_ADDREF(dateArray[i] = dates[i]);
         }
         *aDates = dateArray;
     } else {
         *aDates = nullptr;
     }
--- a/ldap/xpcom/src/nsLDAPBERValue.cpp
+++ b/ldap/xpcom/src/nsLDAPBERValue.cpp
@@ -12,31 +12,31 @@ NS_IMPL_ISUPPORTS(nsLDAPBERValue, nsILDA
 
 nsLDAPBERValue::nsLDAPBERValue() : mValue(0), mSize(0)
 {
 }
 
 nsLDAPBERValue::~nsLDAPBERValue()
 {
     if (mValue) {
-        nsMemory::Free(mValue);
+        free(mValue);
     }
 }
 
 // void get (out unsigned long aCount, 
 //           [array, size_is (aCount), retval] out octet aRetVal); */
 NS_IMETHODIMP 
 nsLDAPBERValue::Get(uint32_t *aCount, uint8_t **aRetVal)
 {
     // if mSize = 0, return a count of a 0 and a null pointer
 
     if (mSize) {
         // get a buffer to hold a copy of the data
         //
-        uint8_t *array = static_cast<uint8_t *>(nsMemory::Alloc(mSize));
+        uint8_t *array = static_cast<uint8_t *>(moz_xmalloc(mSize));
 
         if (!array) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
     
         // copy and return
         //
         memcpy(array, mValue, mSize);
@@ -52,25 +52,25 @@ nsLDAPBERValue::Get(uint32_t *aCount, ui
 // void set(in unsigned long aCount, 
 //          [array, size_is(aCount)] in octet aValue);
 NS_IMETHODIMP
 nsLDAPBERValue::Set(uint32_t aCount, uint8_t *aValue)
 {
     // get rid of any old value being held here
     //
     if (mValue) {
-        nsMemory::Free(mValue);
+        free(mValue);
     }
 
     // if this is a non-zero value, allocate a buffer and copy
     //
     if (aCount) { 
         // get a buffer to hold a copy of this data
         //
-        mValue = static_cast<uint8_t *>(nsMemory::Alloc(aCount));
+        mValue = static_cast<uint8_t *>(moz_xmalloc(aCount));
         if (!mValue) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
         // copy the data and return
         //
         memcpy(mValue, aValue, aCount);
     } else {
@@ -86,17 +86,17 @@ nsLDAPBERValue::Set(uint32_t aCount, uin
 // void setFromUTF8(in AUTF8String aValue);
 //
 NS_IMETHODIMP
 nsLDAPBERValue::SetFromUTF8(const nsACString & aValue)
 {
     // get rid of any old value being held here
     //
     if (mValue) {
-        nsMemory::Free(mValue);
+        free(mValue);
     }
 
     // copy the data and return
     //
     mSize = aValue.Length();
     if (mSize) {
         mValue = reinterpret_cast<uint8_t *>(ToNewCString(aValue));
     } else {
--- a/ldap/xpcom/src/nsLDAPMessage.cpp
+++ b/ldap/xpcom/src/nsLDAPMessage.cpp
@@ -317,17 +317,17 @@ nsLDAPMessage::IterateAttributes(uint32_
         *aAttrCount = 0;
 
         rv = IterateAttributes(aAttrCount, aAttributes, false);
         if (NS_FAILED(rv))
             return rv;
 
         // create an array of the appropriate size
         //
-        *aAttributes = static_cast<char **>(nsMemory::Alloc(*aAttrCount *
+        *aAttributes = static_cast<char **>(moz_xmalloc(*aAttrCount *
                                                       sizeof(char *)));
         if (!*aAttributes) {
             return NS_ERROR_OUT_OF_MEMORY;
         }
     } 
 
     // get the first attribute
     //
@@ -340,17 +340,17 @@ nsLDAPMessage::IterateAttributes(uint32_
     }
 
     // if we're getting attributes, try and fill in the first field
     //
     if (getP) {
         (*aAttributes)[0] = NS_strdup(attr);
         if (!(*aAttributes)[0]) {
             ldap_memfree(attr);
-            nsMemory::Free(*aAttributes);
+            free(*aAttributes);
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
         // note that we start counting again, in order to keep our place in 
         // the array so that we can unwind gracefully and avoid leakage if
         // we hit an error as we're filling in the array
         //
         *aAttrCount = 1;
@@ -486,17 +486,17 @@ nsLDAPMessage::GetValues(const char *aAt
     }
 
     // count the values
     //
     uint32_t numVals = ldap_count_values(values);
 
     // create an array of the appropriate size
     //
-    *aValues = static_cast<char16_t **>(nsMemory::Alloc(numVals * sizeof(char16_t *)));
+    *aValues = static_cast<char16_t **>(moz_xmalloc(numVals * sizeof(char16_t *)));
     if (!*aValues) {
         ldap_value_free(values);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // clone the array (except for the trailing NULL entry) using the 
     // shared allocator for XPCOM correctness
     //
@@ -565,17 +565,17 @@ nsLDAPMessage::GetBinaryValues(const cha
 
     // count the values
     //
     uint32_t numVals = ldap_count_values_len(values);
 
     // create the out array
     //
     *aValues = 
-        static_cast<nsILDAPBERValue **>(nsMemory::Alloc(numVals * sizeof(nsILDAPBERValue)));
+        static_cast<nsILDAPBERValue **>(moz_xmalloc(numVals * sizeof(nsILDAPBERValue)));
     if (!aValues) {
         ldap_value_free_len(values);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // clone the array (except for the trailing NULL entry) using the 
     // shared allocator for XPCOM correctness
     //
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -188,17 +188,17 @@ nsLDAPOperation::SaslBind(const nsACStri
                                  &credlen);
   if (NS_FAILED(rv) || !creds.bv_val)
     return rv;
 
   creds.bv_len = credlen;
   const int lderrno = ldap_sasl_bind(mConnectionHandle, bindName.get(),
                                      mMechanism.get(), &creds, NULL, NULL,
                                      &mMsgID);
-  nsMemory::Free(creds.bv_val);
+  free(creds.bv_val);
 
   if (lderrno != LDAP_SUCCESS)
     return TranslateLDAPErrorToNSError(lderrno);
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
 
@@ -231,17 +231,17 @@ nsLDAPOperation::SaslStep(const char *to
   NS_ENSURE_SUCCESS(rv, rv);
 
   clientCreds.bv_len = credlen;
 
   const int lderrno = ldap_sasl_bind(mConnectionHandle, bindName.get(),
                                      mMechanism.get(), &clientCreds, NULL,
                                      NULL, &mMsgID);
 
-  nsMemory::Free(clientCreds.bv_val);
+  free(clientCreds.bv_val);
 
   if (lderrno != LDAP_SUCCESS)
     return TranslateLDAPErrorToNSError(lderrno);
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
   if (NS_FAILED(rv))
@@ -602,17 +602,17 @@ nsLDAPOperation::AddExt(const char *base
 
   LDAPMod **attrs = 0;
   int retVal = LDAP_SUCCESS;
   uint32_t modCount = 0;
   nsresult rv = mods->GetLength(&modCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (mods && modCount) {
-    attrs = static_cast<LDAPMod **>(nsMemory::Alloc((modCount + 1) *
+    attrs = static_cast<LDAPMod **>(moz_xmalloc((modCount + 1) *
                                                        sizeof(LDAPMod *)));
     if (!attrs) {
       NS_ERROR("nsLDAPOperation::AddExt: out of memory ");
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     nsAutoCString type;
     uint32_t index;
@@ -655,17 +655,17 @@ nsLDAPOperation::AddExt(const char *base
     else
       // reset the modCount so we correctly free the array.
       modCount = index;
   }
 
   for (uint32_t counter = 0; counter < modCount; ++counter)
     delete attrs[counter];
 
-  nsMemory::Free(attrs);
+  free(attrs);
 
   return NS_FAILED(rv) ? rv : TranslateLDAPErrorToNSError(retVal);
 }
 
 /**
  * wrapper for ldap_add_ext(): kicks off an async add request.
  *
  * @param aBaseDn           Base DN to search
@@ -766,17 +766,17 @@ nsLDAPOperation::ModifyExt(const char *b
   }
 
   LDAPMod **attrs = 0;
   int retVal = 0;
   uint32_t modCount = 0;
   nsresult rv = mods->GetLength(&modCount);
   NS_ENSURE_SUCCESS(rv, rv);
   if (modCount && mods) {
-    attrs = static_cast<LDAPMod **>(nsMemory::Alloc((modCount + 1) *
+    attrs = static_cast<LDAPMod **>(moz_xmalloc((modCount + 1) *
                                                        sizeof(LDAPMod *)));
     if (!attrs) {
       NS_ERROR("nsLDAPOperation::ModifyExt: out of memory ");
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     nsAutoCString type;
     uint32_t index;
@@ -817,17 +817,17 @@ nsLDAPOperation::ModifyExt(const char *b
       // reset the modCount so we correctly free the array.
       modCount = index;
 
   }
 
   for (uint32_t counter = 0; counter < modCount; ++counter)
     delete attrs[counter];
 
-  nsMemory::Free(attrs);
+  free(attrs);
 
   return NS_FAILED(rv) ? rv : TranslateLDAPErrorToNSError(retVal);
 }
 
 /**
  * wrapper for ldap_modify_ext(): kicks off an async modify request.
  *
  * @param aBaseDn           Base DN to modify
@@ -939,33 +939,33 @@ nsLDAPOperation::CopyValues(nsILDAPModif
   nsresult rv = aMod->GetValues(getter_AddRefs(values));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint32_t valuesCount;
   rv = values->GetLength(&valuesCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aBValues = static_cast<berval **>
-                         (nsMemory::Alloc((valuesCount + 1) *
+                         (moz_xmalloc((valuesCount + 1) *
                                              sizeof(berval *)));
   if (!*aBValues)
     return NS_ERROR_OUT_OF_MEMORY;
 
   uint32_t valueIndex;
   for (valueIndex = 0; valueIndex < valuesCount; ++valueIndex) {
     nsCOMPtr<nsILDAPBERValue> value(do_QueryElementAt(values, valueIndex, &rv));
 
     berval* bval = new berval;
     if (NS_FAILED(rv) || !bval) {
       for (uint32_t counter = 0;
            counter < valueIndex && counter < valuesCount;
            ++counter)
         delete (*aBValues)[valueIndex];
 
-      nsMemory::Free(*aBValues);
+      free(*aBValues);
       delete bval;
       return NS_ERROR_OUT_OF_MEMORY;
     }
     value->Get((uint32_t*)&bval->bv_len,
                (uint8_t**)&bval->bv_val);
     (*aBValues)[valueIndex] = bval;
   }
 
--- a/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
+++ b/ldap/xpcom/src/nsLDAPSecurityGlue.cpp
@@ -34,17 +34,17 @@ typedef struct {
 } nsLDAPSSLSocketClosure;
 
 // free the per-socket data structure as necessary
 //
 static void
 nsLDAPSSLFreeSocketClosure(nsLDAPSSLSocketClosure **aClosure)
 {
     if (aClosure && *aClosure) {
-	nsMemory::Free(*aClosure);
+	free(*aClosure);
 	*aClosure = nullptr;
     }
 }
 
 // Replacement close() function, which cleans up local stuff associated
 // with this socket, and then calls the real close function.
 //
 extern "C" int LDAP_CALLBACK
@@ -140,17 +140,17 @@ nsLDAPSSLConnect(const char *hostlist, i
     if (prldap_get_socket_info(intfd, *socketargp, &socketInfo)
 	!= LDAP_SUCCESS)  {
 	NS_ERROR("nsLDAPSSLConnect(): unable to get socket info");
         goto close_socket_and_exit_with_error;
     }
 
     // Allocate a structure to hold our socket-specific data.
     //
-    socketClosure = static_cast<nsLDAPSSLSocketClosure *>(nsMemory::Alloc(
+    socketClosure = static_cast<nsLDAPSSLSocketClosure *>(moz_xmalloc(
 				       sizeof(nsLDAPSSLSocketClosure)));
     if (!socketClosure) {
 	NS_WARNING("nsLDAPSSLConnect(): unable to allocate socket closure");
 	goto close_socket_and_exit_with_error;
     }
     memset(socketClosure, 0, sizeof(nsLDAPSSLSocketClosure));
     socketClosure->sessionClosure = sessionClosure;
 
@@ -233,17 +233,17 @@ nsLDAPSSLFreeSessionClosure(nsLDAPSSLSes
 	//
 	if ( (*aSessionClosure)->hostname ) {
 	    PL_strfree((*aSessionClosure)->hostname);
 	    (*aSessionClosure)->hostname = nullptr;
 	}
 
 	// free the structure itself
 	//
-	nsMemory::Free(*aSessionClosure);
+	free(*aSessionClosure);
 	*aSessionClosure = nullptr;
     }
 }
 
 // Replacement session handle disposal code.  First cleans up our local
 // stuff, then calls the original session handle disposal function.
 //
 extern "C" void LDAP_CALLBACK
@@ -272,17 +272,17 @@ nsresult
 nsLDAPInstallSSL( LDAP *ld, const char *aHostName)
 {
     struct ldap_x_ext_io_fns iofns;
     nsLDAPSSLSessionClosure *sessionClosure;
     PRLDAPSessionInfo sessionInfo;
 
     // Allocate our own session information.
     //
-    sessionClosure = static_cast<nsLDAPSSLSessionClosure *>(nsMemory::Alloc(
+    sessionClosure = static_cast<nsLDAPSSLSessionClosure *>(moz_xmalloc(
 					sizeof(nsLDAPSSLSessionClosure)));
     if (!sessionClosure) {
 	return NS_ERROR_OUT_OF_MEMORY;
     }
     memset(sessionClosure, 0, sizeof(nsLDAPSSLSessionClosure));
 
     // Override a few functions, saving a pointer to the original function
     // in each case so we can call it from our SSL savvy functions.
@@ -324,14 +324,14 @@ nsLDAPInstallSSL( LDAP *ld, const char *
 
     // Store session info. for later retrieval.
     //
     sessionInfo.seinfo_size = PRLDAP_SESSIONINFO_SIZE;
     sessionInfo.seinfo_appdata = reinterpret_cast<prldap_session_private *>
                                                  (sessionClosure);
     if (prldap_set_session_info(ld, nullptr, &sessionInfo) != LDAP_SUCCESS) {
 	NS_ERROR("nsLDAPInstallSSL(): error setting prldap session info");
-	nsMemory::Free(sessionClosure);
+	free(sessionClosure);
 	return NS_ERROR_UNEXPECTED;
     }
 
     return NS_OK;
 }
--- a/ldap/xpcom/src/nsLDAPService.cpp
+++ b/ldap/xpcom/src/nsLDAPService.cpp
@@ -750,17 +750,17 @@ NS_IMETHODIMP nsLDAPService::CreateFilte
 
     // figure out how big of an array we're going to need for the tokens,
     // including a trailing NULL, and allocate space for it.
     //
     const char *iter = aValue.BeginReading();
     const char *iterEnd = aValue.EndReading();
     uint32_t numTokens = CountTokens(iter, iterEnd); 
     char **valueWords;
-    valueWords = static_cast<char **>(nsMemory::Alloc((numTokens + 1) *
+    valueWords = static_cast<char **>(moz_xmalloc((numTokens + 1) *
                                                 sizeof(char *)));
     if (!valueWords) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // build the array of values
     //
     uint32_t curToken = 0;
@@ -771,17 +771,17 @@ NS_IMETHODIMP nsLDAPService::CreateFilte
             return NS_ERROR_OUT_OF_MEMORY;
         }
         curToken++;
     }
     valueWords[numTokens] = 0;  // end of array signal to LDAP C SDK
 
     // make buffer to be used for construction 
     //
-    char *buffer = static_cast<char *>(nsMemory::Alloc(aMaxSize * sizeof(char)));
+    char *buffer = static_cast<char *>(moz_xmalloc(aMaxSize * sizeof(char)));
     if (!buffer) {
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(numTokens, valueWords);
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // create the filter itself
     //
     nsresult rv;
@@ -816,17 +816,17 @@ NS_IMETHODIMP nsLDAPService::CreateFilte
         break;
     }
 
     _retval.Assign(buffer);
 
     // done with the array and the buffer
     //
     NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(numTokens, valueWords);
-    nsMemory::Free(buffer);
+    free(buffer);
 
     return rv;
 }
 
 // Parse a distinguished name (DN) and returns the relative DN,
 // base DN and the list of attributes that make up the relative DN.
 NS_IMETHODIMP nsLDAPService::ParseDn(const char *aDn,
                                    nsACString &aRdn,
@@ -874,17 +874,17 @@ NS_IMETHODIMP nsLDAPService::ParseDn(con
         NS_ERROR("nsLDAPService::ParseDn: RDN has too few components");
         ldap_value_free(dnComponents);
         ldap_value_free(rdnComponents);
         return NS_ERROR_UNEXPECTED;
     }
   
     // get the RDN attribute names
     char **attrNameArray = static_cast<char **>(
-        nsMemory::Alloc(rdnCount * sizeof(char *)));
+        moz_xmalloc(rdnCount * sizeof(char *)));
     if (!attrNameArray) {
         NS_ERROR("nsLDAPService::ParseDn: out of memory ");
         ldap_value_free(dnComponents);
         ldap_value_free(rdnComponents);
         return NS_ERROR_OUT_OF_MEMORY;
     }
     uint32_t index = 0;
     for (char **component = rdnComponents; *component; ++component) {
--- a/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbLDAPDirectory.cpp
@@ -923,17 +923,17 @@ nsresult nsAbLDAPDirectory::SplitStringL
 {
   NS_ENSURE_ARG_POINTER(aCount);
   NS_ENSURE_ARG_POINTER(aValues);
 
   nsTArray<nsCString> strarr;
   ParseString(aString, ',', strarr);
 
   char **cArray = nullptr;
-  if (!(cArray = static_cast<char **>(nsMemory::Alloc(
+  if (!(cArray = static_cast<char **>(moz_xmalloc(
       strarr.Length() * sizeof(char *)))))
     return NS_ERROR_OUT_OF_MEMORY;
 
   for (uint32_t i = 0; i < strarr.Length(); ++i)
   {
     if (!(cArray[i] = ToNewCString(strarr[i])))
     {
       NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(strarr.Length(), cArray);
--- a/mailnews/addrbook/src/nsAbLDIFService.cpp
+++ b/mailnews/addrbook/src/nsAbLDIFService.cpp
@@ -370,17 +370,17 @@ void nsAbLDIFService::AddLdifRowToDataba
   while ( (line = str_getline(&cursor)) != nullptr)
   {
     if (NS_SUCCEEDED(str_parse_line(line, &typeSlot, &valueSlot, &length))) {
       AddLdifColToDatabase(aDatabase, newRow, typeSlot, valueSlot, bIsList);
     }
     else
       continue; // parse error: continue with next loop iteration
   }
-  nsMemory::Free(saveCursor);
+  free(saveCursor);
   aDatabase->AddCardRowToDB(newRow);    
 
   if (bIsList)
     aDatabase->AddListDirNode(newRow);
         
   // Clear buffer for next record
   ClearLdifRecordBuffer();
 }
--- a/mailnews/addrbook/src/nsAbUtils.h
+++ b/mailnews/addrbook/src/nsAbUtils.h
@@ -63,17 +63,17 @@ private:
     {
         if (!mArray)
             return;
 
         if (mFreeElements)
             NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mSize, mArray);
         else
         {
-          nsMemory::Free(mArray);
+          free(mArray);
         }
     }
 };
 
 /*
  * Wrapper class to automatically free an array of
  * char16_t* when class goes out of scope
  */
@@ -127,14 +127,14 @@ private:
     {
         if (!mArray)
             return;
 
         if (mFreeElements)
           NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mSize, mArray);
         else
         {
-          nsMemory::Free(mArray);
+          free(mArray);
         }
     }
 };
 
 #endif  /* nsAbUtils_h__ */
--- a/mailnews/addrbook/src/nsAbView.cpp
+++ b/mailnews/addrbook/src/nsAbView.cpp
@@ -1073,19 +1073,19 @@ NS_IMETHODIMP nsAbView::OnItemPropertyCh
   
   if (!CompareCollationKeys(newCard->primaryCollationKey,newCard->primaryCollationKeyLen,oldCard->primaryCollationKey,oldCard->primaryCollationKeyLen)
     && CompareCollationKeys(newCard->secondaryCollationKey,newCard->secondaryCollationKeyLen,oldCard->secondaryCollationKey,oldCard->secondaryCollationKeyLen)) {
     // No need to remove and add, since the collation keys haven't changed.
     // Since they haven't changed, the card will sort to the same place.
     // We just need to clean up what we allocated.
     NS_IF_RELEASE(newCard->card);
     if (newCard->primaryCollationKey)
-      nsMemory::Free(newCard->primaryCollationKey);
+      free(newCard->primaryCollationKey);
     if (newCard->secondaryCollationKey)
-      nsMemory::Free(newCard->secondaryCollationKey);
+      free(newCard->secondaryCollationKey);
     PR_FREEIF(newCard);
 
     // Still need to invalidate, as the other columns may have changed.
     rv = InvalidateTree(index);
     NS_ENSURE_SUCCESS(rv,rv);
   }
   else {
     mSuppressSelectionChange = true;
--- a/mailnews/addrbook/src/nsDirPrefs.cpp
+++ b/mailnews/addrbook/src/nsDirPrefs.cpp
@@ -743,17 +743,17 @@ static nsresult dir_GetChildList(const n
         // elements in the list here, so we just init the two counters sensibly
         // to begin with.
         uint32_t cur = 0;
         for (uint32_t next = 1; next < *aCount; ++next) {
             // check if the elements are equal or unique
             if (!comparePrefArrayMembers(&((*aChildList)[cur]), &((*aChildList)[next]), &branchLen)) {
                 // equal - just free & increment the next element ptr
 
-                nsMemory::Free((*aChildList)[next]);
+                free((*aChildList)[next]);
             } else {
                 // cur & next are unique, so we need to shift the element.
                 // ++cur will point to the next free location in the
                 // reduced array (it's okay if that's == next)
                 (*aChildList)[++cur] = (*aChildList)[next];
             }
         }
 
--- a/mailnews/base/search/src/nsMsgFilterList.cpp
+++ b/mailnews/base/search/src/nsMsgFilterList.cpp
@@ -679,17 +679,17 @@ nsresult nsMsgFilterList::LoadTextFilter
           nsAutoString unicodeStr;
           err = nsMsgI18NConvertToUnicode(nsMsgI18NFileSystemCharset(),
                                           value, unicodeStr);
           if (NS_FAILED(err))
               break;
 
           char *utf8 = ToNewUTF8String(unicodeStr);
           value.Assign(utf8);
-          nsMemory::Free(utf8);
+          free(utf8);
         }
         err = ParseCondition(m_curFilter, value.get());
         if (err == NS_ERROR_INVALID_ARG)
           err = m_curFilter->SetUnparseable(true);
         NS_ENSURE_SUCCESS(err, err);
       }
       break;
     case nsIMsgFilterList::attribCustomId:
--- a/mailnews/base/search/src/nsMsgSearchAdapter.cpp
+++ b/mailnews/base/search/src/nsMsgSearchAdapter.cpp
@@ -863,17 +863,17 @@ nsMsgSearchValidityTable::GetAvailableAt
             if (m_table[i][j].bitAvailable) {
                 totalAttributes++;
                 break;
             }
         }
     }
 
     nsMsgSearchAttribValue *array = (nsMsgSearchAttribValue*)
-        nsMemory::Alloc(sizeof(nsMsgSearchAttribValue) * totalAttributes);
+        moz_xmalloc(sizeof(nsMsgSearchAttribValue) * totalAttributes);
     NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t numStored=0;
     for (i = 0; i< nsMsgSearchAttrib::kNumMsgSearchAttributes; i++) {
         for (j=0; j< nsMsgSearchOp::kNumMsgSearchOperators; j++) {
             if (m_table[i][j].bitAvailable) {
                 array[numStored++] = i;
                 break;
@@ -906,17 +906,17 @@ nsMsgSearchValidityTable::GetAvailableOp
     uint32_t totalOperators=0;
     int32_t i;
     for (i=0; i<nsMsgSearchOp::kNumMsgSearchOperators; i++) {
         if (m_table[attr][i].bitAvailable)
             totalOperators++;
     }
 
     nsMsgSearchOpValue *array = (nsMsgSearchOpValue*)
-        nsMemory::Alloc(sizeof(nsMsgSearchOpValue) * totalOperators);
+        moz_xmalloc(sizeof(nsMsgSearchOpValue) * totalOperators);
     NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t numStored = 0;
     for (i=0; i<nsMsgSearchOp::kNumMsgSearchOperators;i++) {
         if (m_table[attr][i].bitAvailable)
             array[numStored++] = i;
     }
 
--- a/mailnews/base/search/src/nsMsgSearchNews.cpp
+++ b/mailnews/base/search/src/nsMsgSearchNews.cpp
@@ -63,17 +63,17 @@ nsresult nsMsgSearchNews::Search (bool *
 }
 
 char16_t *nsMsgSearchNews::EncodeToWildmat (const char16_t *value)
 {
   // Here we take advantage of XPAT's use of the wildmat format, which allows
   // a case-insensitive match by specifying each case possibility for each character
   // So, "FooBar" is encoded as "[Ff][Oo][Bb][Aa][Rr]"
 
-  char16_t *caseInsensitiveValue = (char16_t*) nsMemory::Alloc(sizeof(char16_t) * ((4 * NS_strlen(value)) + 1));
+  char16_t *caseInsensitiveValue = (char16_t*) moz_xmalloc(sizeof(char16_t) * ((4 * NS_strlen(value)) + 1));
   if (caseInsensitiveValue)
   {
     char16_t *walkValue = caseInsensitiveValue;
     while (*value)
     {
       if (isalpha(*value))
       {
         *walkValue++ = (char16_t)'[';
@@ -171,17 +171,17 @@ char *nsMsgSearchNews::EncodeTerm (nsIMs
     return nullptr;
 
   // TO DO: Do INTL_FormatNNTPXPATInRFC1522Format trick for non-ASCII string
   // Unfortunately, we currently do not handle xxx or xxx search in XPAT
   // Need to add the INTL_FormatNNTPXPATInRFC1522Format call after we can do that
   // so we should search a string in either RFC1522 format and non-RFC1522 format
 
   char16_t *escapedValue = EscapeSearchUrl (caseInsensitiveValue);
-  nsMemory::Free(caseInsensitiveValue);
+  free(caseInsensitiveValue);
   if (!escapedValue)
     return nullptr;
 
   nsAutoCString pattern;
 
   if (leadingStar)
       pattern.Append('*');
     pattern.Append(NS_ConvertUTF16toUTF8(escapedValue));
--- a/mailnews/base/src/nsMessenger.cpp
+++ b/mailnews/base/src/nsMessenger.cpp
@@ -2174,17 +2174,17 @@ NS_IMETHODIMP nsMessenger::GetNavigateHi
 
   *aCurPos = mCurHistoryPos >> 1;
   *aCount = mLoadedMsgHistory.Length();
   // for just enabling commands, we don't need the history uris.
   if (!aHistoryUris)
     return NS_OK;
 
   char **outArray, **next;
-  next = outArray = (char **)nsMemory::Alloc(*aCount * sizeof(char *));
+  next = outArray = (char **)moz_xmalloc(*aCount * sizeof(char *));
   if (!outArray) return NS_ERROR_OUT_OF_MEMORY;
   for (uint32_t i = 0; i < *aCount; i++)
   {
     *next = ToNewCString(mLoadedMsgHistory[i]);
     if (!*next)
       return NS_ERROR_OUT_OF_MEMORY;
     next++;
   }
--- a/mailnews/base/src/nsMsgDBView.cpp
+++ b/mailnews/base/src/nsMsgDBView.cpp
@@ -2463,17 +2463,17 @@ NS_IMETHODIMP nsMsgDBView::GetURIsForSel
   nsCOMPtr<nsIMutableArray> messages(do_CreateInstance(NS_ARRAY_CONTRACTID, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = GetHeadersFromSelection(selection.Elements(), numIndices, messages);
   NS_ENSURE_SUCCESS(rv, rv);
   messages->GetLength(length);
   uint32_t numMsgsSelected = *length;
 
   char **outArray, **next;
-  next = outArray = (char **)nsMemory::Alloc(numMsgsSelected * sizeof(char *));
+  next = outArray = (char **)moz_xmalloc(numMsgsSelected * sizeof(char *));
   if (!outArray) return NS_ERROR_OUT_OF_MEMORY;
   for (uint32_t i = 0; i < numMsgsSelected; i++)
   {
     nsCString tmpUri;
     nsCOMPtr<nsIMsgDBHdr> msgHdr = do_QueryElementAt(messages, i, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     nsCOMPtr<nsIMsgFolder> folder;
     nsMsgKey msgKey;
--- a/mailnews/base/util/nsMsgDBFolder.cpp
+++ b/mailnews/base/util/nsMsgDBFolder.cpp
@@ -1480,32 +1480,32 @@ nsMsgDBFolder::MarkAllMessagesRead(nsIMs
     uint32_t numMarked;
     rv = mDatabase->MarkAllRead(&numMarked, &thoseMarked);
     EnableNotifications(allMessageCountNotifications, true, true /*dbBatching*/);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Setup a undo-state
     if (aMsgWindow && numMarked)
       rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
-    nsMemory::Free(thoseMarked);
+    free(thoseMarked);
   }
 
   SetHasNewMessages(false);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgDBFolder::MarkThreadRead(nsIMsgThread *thread)
 {
   nsresult rv = GetDatabase();
   if(NS_SUCCEEDED(rv))
   {
     nsMsgKey *keys;
     uint32_t numKeys;
     rv = mDatabase->MarkThreadRead(thread, nullptr, &numKeys, &keys);
-    nsMemory::Free(keys);
+    free(keys);
   }
   return rv;
 }
 
 NS_IMETHODIMP
 nsMsgDBFolder::OnStartRunningUrl(nsIURI *aUrl)
 {
   return NS_OK;
--- a/mailnews/base/util/nsMsgKeySet.cpp
+++ b/mailnews/base/util/nsMsgKeySet.cpp
@@ -281,35 +281,35 @@ nsMsgKeySet::Output(char **outputStr)
   *outputStr = nullptr;
 
   size = m_length;
   head = m_data;
   tail = head;
   end = head + size;
 
   s_size = (size * 12) + 10;  // dmb - try to make this allocation get used at least once.
-  s_head = (char *) nsMemory::Alloc(s_size);
+  s_head = (char *) moz_xmalloc(s_size);
   if (! s_head) return NS_ERROR_OUT_OF_MEMORY;
 
   s_head[0] = '\0';      // otherwise, s_head will contain garbage.
   s = s_head;
   s_end = s + s_size;
 
   while (tail < end) {
     int32_t from;
     int32_t to;
 
     if (s > (s_end - (12 * 2 + 10))) { /* 12 bytes for each number (enough
                         for "2147483647" aka 2^31-1),
                         plus 10 bytes of slop. */
       int32_t so = s - s_head;
       s_size += 200;
-      char* tmp = (char *) nsMemory::Alloc(s_size);
+      char* tmp = (char *) moz_xmalloc(s_size);
       if (tmp) PL_strcpy(tmp, s_head);
-      nsMemory::Free(s_head);
+      free(s_head);
       s_head = tmp;
       if (!s_head) return NS_ERROR_OUT_OF_MEMORY;
       s = s_head + so;
       s_end = s_head + s_size;
     }
 
     if (*tail < 0) {
       /* it's a range */
@@ -1206,42 +1206,42 @@ nsMsgKeySet::ToMsgKeyArray(nsTArray<nsMs
 
 void
 nsMsgKeySet::test_decoder (const char *string)
 {
   nsMsgKeySet set(string /* , NULL */);
   char* tmp;
   set.Output(&tmp);
   printf ("\t\"%s\"\t--> \"%s\"\n", string, tmp);
-  nsMemory::Free(tmp);
+  free(tmp);
 }
 
 
 #define START(STRING) \
   string = STRING;    \
   if (!(set = nsMsgKeySet::Create(string))) abort ()
 
 #define FROB(N,PUSHP)                  \
   i = N;                        \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %-58s %c %3lu =\n", (unsigned long)set->m_length, s,  \
       (PUSHP ? '+' : '-'), (unsigned long)i);            \
-  nsMemory::Free(s);                      \
+  free(s);                      \
   if (PUSHP                        \
     ? set->Add(i) < 0                  \
     : set->Remove(i) < 0)                \
   abort ();                      \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %-58s optimized =\n", (unsigned long)set->m_length, s);  \
-  nsMemory::Free(s);                      \
+  free(s);                      \
 
 #define END()                 \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \
-  nsMemory::Free(s);                      \
+  free(s);                      \
   delete set;                 \
 
 
 
 void
 nsMsgKeySet::test_adder (void)
 {
   const char *string;
@@ -1327,35 +1327,35 @@ nsMsgKeySet::test_adder (void)
   string = STRING;    \
   if (!(set = nsMsgKeySet::Create(string))) abort ()
 
 #define FROB(N,M)                        \
   i = N;                            \
   j = M;                            \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %-58s + %3lu-%3lu =\n", (unsigned long)set->m_length, s, (unsigned long)i, (unsigned long)j);  \
-  nsMemory::Free(s);                      \
+  free(s);                      \
   switch (set->AddRange(i, j)) {                \
   case 0:                            \
   printf("(no-op)\n");                    \
   break;                            \
   case 1:                            \
   break;                            \
   default:                            \
   abort();                          \
   }                                \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %-58s\n", (unsigned long)set->m_length, s);            \
-  nsMemory::Free(s);                      \
+  free(s);                      \
 
 
 #define END()                 \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf ("%3lu: %s\n\n", (unsigned long)set->m_length, s); \
-  nsMemory::Free(s);                      \
+  free(s);                      \
   delete set;
 
 
 void
 nsMsgKeySet::test_ranges(void)
 {
   const char *string;
   nsMsgKeySet *set;
@@ -1386,17 +1386,17 @@ nsMsgKeySet::test_ranges(void)
 
 
 
 #define TEST(N)                    \
   if (! with_cache) set->m_cached_value = -1;    \
   if (!(NS_SUCCEEDED(set->Output(&s)))) abort ();          \
   printf (" %3d = %s\n", N,              \
       (set->IsMember(N) ? "true" : "false")); \
-  nsMemory::Free(s);
+  free(s);
 
 void
 nsMsgKeySet::test_member(bool with_cache)
 {
   nsMsgKeySet *set;
   char *s;
 
   s = "1-70,72-99,105,107,110-111,117-200";
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -829,17 +829,17 @@ nsresult nsMsgProtocol::DoGSSAPIStep1(co
     rv = m_authModule->GetNextToken((void *)nullptr, 0, &outBuf, &outBufLen);
     if (NS_SUCCEEDED(rv) && outBuf)
     {
         char *base64Str = PL_Base64Encode((char *)outBuf, outBufLen, nullptr);
         if (base64Str)
             response.Adopt(base64Str);
         else
             rv = NS_ERROR_OUT_OF_MEMORY;
-        nsMemory::Free(outBuf);
+        free(outBuf);
     }
 
 #ifdef DEBUG_BenB
     printf("GSSAPI step 1 succeeded\n");
 #endif
     return rv;
 }
 
@@ -852,17 +852,17 @@ nsresult nsMsgProtocol::DoGSSAPIStep2(ns
     void *inBuf, *outBuf;
     uint32_t inBufLen, outBufLen;
     uint32_t len = commandResponse.Length();
 
     // Cyrus SASL may send us zero length tokens (grrrr)
     if (len > 0) {
         // decode into the input secbuffer
         inBufLen = (len * 3)/4;      // sufficient size (see plbase64.h)
-        inBuf = nsMemory::Alloc(inBufLen);
+        inBuf = moz_xmalloc(inBufLen);
         if (!inBuf)
             return NS_ERROR_OUT_OF_MEMORY;
 
         // strip off any padding (see bug 230351)
         const char *challenge = commandResponse.get();
         while (challenge[len - 1] == '=')
             len--;
 
@@ -875,17 +875,17 @@ nsresult nsMsgProtocol::DoGSSAPIStep2(ns
         // If there are 2 remaining, add 1
         // 1 remaining is an error
         inBufLen = (len / 4)*3 + ((len % 4 == 3)?2:0) + ((len % 4 == 2)?1:0);
 
         rv = (PL_Base64Decode(challenge, len, (char *)inBuf))
              ? m_authModule->GetNextToken(inBuf, inBufLen, &outBuf, &outBufLen)
              : NS_ERROR_FAILURE;
 
-        nsMemory::Free(inBuf);
+        free(inBuf);
     }
     else
     {
         rv = m_authModule->GetNextToken(NULL, 0, &outBuf, &outBufLen);
     }
     if (NS_SUCCEEDED(rv))
     {
         // And in return, we may need to send Cyrus zero length tokens back
@@ -924,45 +924,45 @@ nsresult nsMsgProtocol::DoNtlmStep1(cons
     rv = m_authModule->GetNextToken((void *)nullptr, 0, &outBuf, &outBufLen);
     if (NS_SUCCEEDED(rv) && outBuf)
     {
         char *base64Str = PL_Base64Encode((char *)outBuf, outBufLen, nullptr);
         if (base64Str)
           response.Adopt(base64Str);
         else
           rv = NS_ERROR_OUT_OF_MEMORY;
-        nsMemory::Free(outBuf);
+        free(outBuf);
     }
 
     return rv;
 }
 
 nsresult nsMsgProtocol::DoNtlmStep2(nsCString &commandResponse, nsCString &response)
 {
     nsresult rv;
     void *inBuf, *outBuf;
     uint32_t inBufLen, outBufLen;
     uint32_t len = commandResponse.Length();
 
     // decode into the input secbuffer
     inBufLen = (len * 3)/4;      // sufficient size (see plbase64.h)
-    inBuf = nsMemory::Alloc(inBufLen);
+    inBuf = moz_xmalloc(inBufLen);
     if (!inBuf)
         return NS_ERROR_OUT_OF_MEMORY;
 
     // strip off any padding (see bug 230351)
     const char *challenge = commandResponse.get();
     while (challenge[len - 1] == '=')
         len--;
 
     rv = (PL_Base64Decode(challenge, len, (char *)inBuf))
          ? m_authModule->GetNextToken(inBuf, inBufLen, &outBuf, &outBufLen)
          : NS_ERROR_FAILURE;
 
-    nsMemory::Free(inBuf);
+    free(inBuf);
     if (NS_SUCCEEDED(rv) && outBuf)
     {
         char *base64Str = PL_Base64Encode((char *)outBuf, outBufLen, nullptr);
         if (base64Str)
           response.Adopt(base64Str);
         else
           rv = NS_ERROR_OUT_OF_MEMORY;
     }
--- a/mailnews/base/util/nsMsgUtils.cpp
+++ b/mailnews/base/util/nsMsgUtils.cpp
@@ -1794,17 +1794,17 @@ NS_MSG_BASE char16_t *MsgEscapeHTML2(con
     aSourceBufferLen = NS_strlen(aSourceBuffer); // ...then I will
   }
 
   /* XXX Hardcoded max entity len. */
   if (aSourceBufferLen >=
     ((PR_UINT32_MAX - sizeof(char16_t)) / (6 * sizeof(char16_t))) )
       return nullptr;
 
-  char16_t *resultBuffer = (char16_t *)nsMemory::Alloc(aSourceBufferLen *
+  char16_t *resultBuffer = (char16_t *)moz_xmalloc(aSourceBufferLen *
                             6 * sizeof(char16_t) + sizeof(char16_t('\0')));
 
   char16_t *ptr = resultBuffer;
 
   if (resultBuffer) {
     int32_t i;
 
     for(i = 0; i < aSourceBufferLen; i++) {
--- a/mailnews/compose/src/nsMsgCompose.cpp
+++ b/mailnews/compose/src/nsMsgCompose.cpp
@@ -2143,17 +2143,17 @@ NS_IMETHODIMP nsMsgCompose::GetOriginalM
 
 ////////////////////////////////////////////////////////////////////////////////////
 // THIS IS THE CLASS THAT IS THE STREAM CONSUMER OF THE HTML OUPUT
 // FROM LIBMIME. THIS IS FOR QUOTING
 ////////////////////////////////////////////////////////////////////////////////////
 QuotingOutputStreamListener::~QuotingOutputStreamListener()
 {
   if (mUnicodeConversionBuffer)
-    nsMemory::Free(mUnicodeConversionBuffer);
+    free(mUnicodeConversionBuffer);
 }
 
 QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMsgURI,
                                                          nsIMsgDBHdr *originalMsgHdr,
                                                          bool quoteHeaders,
                                                          bool headersOnly,
                                                          nsIMsgIdentity *identity,
                                                          const char *charset,
@@ -2878,18 +2878,18 @@ NS_IMETHODIMP QuotingOutputStreamListene
 
         if (unicharLength > kLocalBufSize)
         {
           // Otherwise, use the buffer of the class.
           if (!mUnicodeConversionBuffer ||
               unicharLength > mUnicodeBufferCharacterLength)
           {
             if (mUnicodeConversionBuffer)
-              nsMemory::Free(mUnicodeConversionBuffer);
-            mUnicodeConversionBuffer = (char16_t *) nsMemory::Alloc(unicharLength * sizeof(char16_t));
+              free(mUnicodeConversionBuffer);
+            mUnicodeConversionBuffer = (char16_t *) moz_xmalloc(unicharLength * sizeof(char16_t));
             if (!mUnicodeConversionBuffer)
             {
               mUnicodeBufferCharacterLength = 0;
               return NS_ERROR_OUT_OF_MEMORY;
             }
             mUnicodeBufferCharacterLength = unicharLength;
           }
           unichars = mUnicodeConversionBuffer;
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -636,17 +636,17 @@ NS_IMETHODIMP nsMsgComposeService::GetPa
       {
         if (composeHTMLFormat)
         {
           char *escaped = MsgEscapeHTML(bodyPart.get());
           if (!escaped)
             return NS_ERROR_OUT_OF_MEMORY;
 
           CopyUTF8toUTF16(nsDependentCString(escaped), sanitizedBody);
-          nsMemory::Free(escaped);
+          free(escaped);
         }
         else
           CopyUTF8toUTF16(bodyPart, rawBody);
       }
       else
         CopyUTF8toUTF16(HTMLBodyPart, rawBody);
 
       if (!rawBody.IsEmpty() && composeHTMLFormat)
--- a/mailnews/compose/src/nsMsgSend.cpp
+++ b/mailnews/compose/src/nsMsgSend.cpp
@@ -1958,17 +1958,17 @@ nsMsgComposeAndSend::ProcessMultipartRel
       anchor->SetHref(NS_ConvertASCIItoUTF16(domSaveArray[i].url));
     else if (link)
       link->SetHref(NS_ConvertASCIItoUTF16(domSaveArray[i].url));
     else if (image)
       image->SetSrc(NS_ConvertASCIItoUTF16(domSaveArray[i].url));
     else if (body)
       body->SetBackground(NS_ConvertASCIItoUTF16(domSaveArray[i].url));
 
-    nsMemory::Free(domSaveArray[i].url);
+    free(domSaveArray[i].url);
   }
 
   PR_FREEIF(domSaveArray);
 
   //
   // Now, we have to create that first child node for the multipart
   // message that holds the body as well as the attachment handler
   // for this body part.
--- a/mailnews/db/msgdb/public/nsIMsgDatabase.idl
+++ b/mailnews/db/msgdb/public/nsIMsgDatabase.idl
@@ -554,17 +554,17 @@ interface nsIMsgDatabase : nsIDBChangeAn
 
   // for msg hdr hash table allocation. controllable by caller to improve folder loading preformance.
   attribute unsigned long msgHdrCacheSize;
 
   /**
    * The list of messages currently in the NEW state.
    * 
    * If there are no such messages, a null pointer may be returned.
-   * the caller should free when done using nsMemory::Free.
+   * the caller should free when done using free.
    */
   void getNewList(out unsigned long count, [array, size_is(count)] out nsMsgKey newKeys);
   
   // These are used for caching search hits in a db, to speed up saved search folders.
   nsISimpleEnumerator getCachedHits(in string aSearchFolderUri);
   void refreshCache(in string aSearchFolderUri, in unsigned long aNumKeys, [array, size_is (aNumKeys)] in nsMsgKey aNewHits,
      out unsigned long aNumBadHits, [array, size_is(aNumBadHits)] out nsMsgKey aStaleHits);
   void updateHdrInCache(in string aSearchFolderUri, in nsIMsgDBHdr aHdr, in boolean aAdd);
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -4031,17 +4031,17 @@ nsresult nsMsgDatabase::SetBooleanProper
 
 nsresult nsMsgDatabase::SetNSStringPropertyWithToken(nsIMdbRow *row, mdb_token aProperty, const nsAString &propertyStr)
 {
   NS_ENSURE_ARG(row);
   struct mdbYarn yarn;
 
   yarn.mYarn_Grow = NULL;
   nsresult err = row->AddColumn(GetEnv(), aProperty, nsStringToYarn(&yarn, propertyStr));
-  nsMemory::Free((char *)yarn.mYarn_Buf);  // won't need this when we have nsCString
+  free((char *)yarn.mYarn_Buf);  // won't need this when we have nsCString
   return err;
 }
 
 
 uint32_t nsMsgDatabase::GetCurVersion()
 {
   return kMsgDBVersion;
 }
@@ -5672,17 +5672,17 @@ NS_IMETHODIMP
 nsMsgDatabase::GetNewList(uint32_t *aCount, nsMsgKey **aNewKeys)
 {
     NS_ENSURE_ARG_POINTER(aCount);
     NS_ENSURE_ARG_POINTER(aNewKeys);
 
     *aCount = m_newSet.Length();
     if (*aCount > 0)
     {
-      *aNewKeys = static_cast<nsMsgKey *>(nsMemory::Alloc(*aCount * sizeof(nsMsgKey)));
+      *aNewKeys = static_cast<nsMsgKey *>(moz_xmalloc(*aCount * sizeof(nsMsgKey)));
       if (!*aNewKeys)
         return NS_ERROR_OUT_OF_MEMORY;
       memcpy(*aNewKeys, m_newSet.Elements(), *aCount * sizeof(nsMsgKey));
       return NS_OK;
     }
     // if there were no new messages, signal this by returning a null pointer
     //
     *aNewKeys = nullptr;
@@ -5780,17 +5780,17 @@ NS_IMETHODIMP nsMsgDatabase::RefreshCach
       table->CutOid(GetEnv(), &oid);
       rowCount--;
       continue; // don't increment tableRowIndex since we removed that row.
     }
    }
    *aNumBadHits = staleHits.Length();
    if (*aNumBadHits)
    {
-     *aStaleHits = static_cast<nsMsgKey *>(nsMemory::Alloc(*aNumBadHits * sizeof(nsMsgKey)));
+     *aStaleHits = static_cast<nsMsgKey *>(moz_xmalloc(*aNumBadHits * sizeof(nsMsgKey)));
      if (!*aStaleHits)
        return NS_ERROR_OUT_OF_MEMORY;
      memcpy(*aStaleHits, staleHits.Elements(), *aNumBadHits * sizeof(nsMsgKey));
    }
    else
      *aStaleHits = nullptr;
 
 #ifdef DEBUG_David_Bienvenu
--- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
+++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
@@ -1253,17 +1253,17 @@ public:
         mTraitListener(aTraitListener),
         mDetailListener(aDetailListener),
         mProTraits(aProTraits),
         mAntiTraits(aAntiTraits),
         mMsgWindow(aMsgWindow)
     {
       mCurMessageToClassify = 0;
       mNumMessagesToClassify = aNumMessagesToClassify;
-      mMessageURIs = (char **) nsMemory::Alloc(sizeof(char *) * aNumMessagesToClassify);
+      mMessageURIs = (char **) moz_xmalloc(sizeof(char *) * aNumMessagesToClassify);
       for (uint32_t i = 0; i < aNumMessagesToClassify; i++)
         mMessageURIs[i] = PL_strdup(aMessageURIs[i]);
 
     }
 
     // junk-only classifier
     MessageClassifier(nsBayesianFilter* aFilter,
                       nsIJunkMailClassificationListener* aJunkListener,
@@ -1274,17 +1274,17 @@ public:
         mJunkMailPlugin(aFilter),
         mJunkListener(aJunkListener),
         mTraitListener(nullptr),
         mDetailListener(nullptr),
         mMsgWindow(aMsgWindow)
     {
       mCurMessageToClassify = 0;
       mNumMessagesToClassify = aNumMessagesToClassify;
-      mMessageURIs = (char **) nsMemory::Alloc(sizeof(char *) * aNumMessagesToClassify);
+      mMessageURIs = (char **) moz_xmalloc(sizeof(char *) * aNumMessagesToClassify);
       for (uint32_t i = 0; i < aNumMessagesToClassify; i++)
         mMessageURIs[i] = PL_strdup(aMessageURIs[i]);
       mProTraits.AppendElement(kJunkTrait);
       mAntiTraits.AppendElement(kGoodTrait);
 
     }
 
     virtual ~MessageClassifier()
--- a/mailnews/extensions/smime/src/nsSMimeJSHelper.cpp
+++ b/mailnews/extensions/smime/src/nsSMimeJSHelper.cpp
@@ -58,29 +58,29 @@ NS_IMETHODIMP nsSMimeJSHelper::GetRecipi
   nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
 
   *count = mailbox_count;
   *canEncrypt = false;
   rv = NS_OK;
 
   if (mailbox_count)
   {
-    char16_t **outEA = static_cast<char16_t **>(nsMemory::Alloc(mailbox_count * sizeof(char16_t *)));
-    int32_t *outCV = static_cast<int32_t *>(nsMemory::Alloc(mailbox_count * sizeof(int32_t)));
-    char16_t **outCII = static_cast<char16_t **>(nsMemory::Alloc(mailbox_count * sizeof(char16_t *)));
-    char16_t **outCEI = static_cast<char16_t **>(nsMemory::Alloc(mailbox_count * sizeof(char16_t *)));
-    nsIX509Cert **outCerts = static_cast<nsIX509Cert **>(nsMemory::Alloc(mailbox_count * sizeof(nsIX509Cert *)));
+    char16_t **outEA = static_cast<char16_t **>(moz_xmalloc(mailbox_count * sizeof(char16_t *)));
+    int32_t *outCV = static_cast<int32_t *>(moz_xmalloc(mailbox_count * sizeof(int32_t)));
+    char16_t **outCII = static_cast<char16_t **>(moz_xmalloc(mailbox_count * sizeof(char16_t *)));
+    char16_t **outCEI = static_cast<char16_t **>(moz_xmalloc(mailbox_count * sizeof(char16_t *)));
+    nsIX509Cert **outCerts = static_cast<nsIX509Cert **>(moz_xmalloc(mailbox_count * sizeof(nsIX509Cert *)));
 
     if (!outEA || !outCV || !outCII || !outCEI || !outCerts)
     {
-      nsMemory::Free(outEA);
-      nsMemory::Free(outCV);
-      nsMemory::Free(outCII);
-      nsMemory::Free(outCEI);
-      nsMemory::Free(outCerts);
+      free(outEA);
+      free(outCV);
+      free(outCII);
+      free(outCEI);
+      free(outCerts);
       rv = NS_ERROR_OUT_OF_MEMORY;
     }
     else
     {
       char16_t **iEA = outEA;
       int32_t *iCV = outCV;
       char16_t **iCII = outCII;
       char16_t **iCEI = outCEI;
@@ -151,17 +151,17 @@ NS_IMETHODIMP nsSMimeJSHelper::GetRecipi
         }
       }
 
       if (memory_failure) {
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mailbox_count, outEA);
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mailbox_count, outCII);
         NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(mailbox_count, outCEI);
         NS_FREE_XPCOM_ISUPPORTS_POINTER_ARRAY(mailbox_count, outCerts);
-        nsMemory::Free(outCV);
+        free(outCV);
         rv = NS_ERROR_OUT_OF_MEMORY;
       }
       else {
         if (mailbox_count > 0 && !found_blocker)
         {
           *canEncrypt = true;
         }
 
@@ -230,17 +230,17 @@ NS_IMETHODIMP nsSMimeJSHelper::GetNoCert
         ++missing_count;
     }
   }
 
   *count = missing_count;
 
   if (missing_count)
   {
-    char16_t **outEA = static_cast<char16_t **>(nsMemory::Alloc(missing_count * sizeof(char16_t *)));
+    char16_t **outEA = static_cast<char16_t **>(moz_xmalloc(missing_count * sizeof(char16_t *)));
     if (!outEA )
     {
       rv = NS_ERROR_OUT_OF_MEMORY;
     }
     else
     {
       char16_t **iEA = outEA;
 
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -1910,17 +1910,17 @@ nsImapMailFolder::MarkAllMessagesRead(ns
     {
       rv = StoreImapFlags(kImapMsgSeenFlag, true, thoseMarked,
                           numMarked, nullptr);
       mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
 
       // Setup a undo-state
       if (aMsgWindow)
         rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
-      nsMemory::Free(thoseMarked);
+      free(thoseMarked);
     }
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapMailFolder::MarkThreadRead(nsIMsgThread *thread)
 {
   nsresult rv = GetDatabase();
@@ -1928,17 +1928,17 @@ NS_IMETHODIMP nsImapMailFolder::MarkThre
   {
     nsMsgKey *keys;
     uint32_t numKeys;
     rv = mDatabase->MarkThreadRead(thread, nullptr, &numKeys, &keys);
     if (NS_SUCCEEDED(rv) && numKeys)
     {
       rv = StoreImapFlags(kImapMsgSeenFlag, true, keys, numKeys, nullptr);
       mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
-      nsMemory::Free(keys);
+      free(keys);
     }
   }
   return rv;
 }
 
 
 NS_IMETHODIMP nsImapMailFolder::ReadFromFolderCacheElem(nsIMsgFolderCacheElement *element)
 {
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -3558,17 +3558,17 @@ nsImapProtocol::FetchMessage(const nsCSt
         protocolStringSize,                                      // max size
         cCommandStr,                                   // format string
         commandTag,                          // command tag
         messageIds.get());
     }
 
     nsresult rv = SendData(protocolString);
 
-    nsMemory::Free(cCommandStr);
+    free(cCommandStr);
     if (NS_SUCCEEDED(rv))
       ParseIMAPandCheckForNewMail(protocolString);
     PR_Free(protocolString);
     GetServerStateParser().SetFetchingFlags(false);
     // Always clear this flag after every fetch.
     m_fetchingWholeMessage = false;
     if (GetServerStateParser().LastCommandSuccessful() && CheckNeeded())
       Check();
--- a/mailnews/imap/src/nsImapUrl.cpp
+++ b/mailnews/imap/src/nsImapUrl.cpp
@@ -856,17 +856,17 @@ NS_IMETHODIMP nsImapUrl::AllocateServerP
   const char *src = sourcePath;
   int32_t i;
   for ( i = 0; i < len; i++)
   {
     if (*src == '^')
       extra += 1; /* ^ -> ^^ */
     src++;
   }
-  char* result = (char *)nsMemory::Alloc(len + extra + 1);
+  char* result = (char *)moz_xmalloc(len + extra + 1);
   if (!result)
     return NS_ERROR_OUT_OF_MEMORY;
 
   register unsigned char* dst = (unsigned char *) result;
   src = sourcePath;
   for (i = 0; i < len; i++)
   {
     unsigned char c = *src++;
--- a/mailnews/import/outlook/src/MapiApi.cpp
+++ b/mailnews/import/outlook/src/MapiApi.cpp
@@ -982,26 +982,26 @@ BOOL CMapiApi::IterateStores(CMapiFolder
         // does not exist, then szContents will be zero.  We'll
         // assume that any store that doesn't have anything in
         // it's hierarchy tree is not a store we want to import -
         // there would be nothing to import from anyway!
         // Currently, this does exclude IMAP server accounts
         // which is the desired behaviour.
 
         int         strLen = strlen(lpStr);
-        char16_t * pwszStr = (char16_t *) nsMemory::Alloc((strLen + 1) * sizeof(WCHAR));
+        char16_t * pwszStr = (char16_t *) moz_xmalloc((strLen + 1) * sizeof(WCHAR));
         if (!pwszStr) {
           // out of memory
           FreeProws(lpRow);
           lpTable->Release();
           return FALSE;
         }
         ::MultiByteToWideChar(CP_ACP, 0, lpStr, strlen(lpStr) + 1, pwszStr, (strLen + 1) * sizeof(WCHAR));
         CMapiFolder *pFolder = new CMapiFolder(pwszStr, cbEID, lpEID, 0, MAPI_STORE);
-        nsMemory::Free(pwszStr);
+        free(pwszStr);
 
         long szContents = 1;
         GetStoreInfo(pFolder, &szContents);
 
         MAPI_TRACE1("    DisplayName: %s\n", lpStr);
         if (szContents)
           stores.AddItem(pFolder);
         else {
--- a/mailnews/local/src/nsLocalMailFolder.cpp
+++ b/mailnews/local/src/nsLocalMailFolder.cpp
@@ -1328,17 +1328,17 @@ nsMsgLocalMailFolder::MarkAllMessagesRea
 
     mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
 
     // Setup a undo-state
     if (aMsgWindow)
       rv = AddMarkAllReadUndoAction(aMsgWindow, thoseMarked, numMarked);
   } while (false);
 
-  nsMemory::Free(thoseMarked);
+  free(thoseMarked);
   return rv;
 }
 
 NS_IMETHODIMP nsMsgLocalMailFolder::MarkThreadRead(nsIMsgThread *thread)
 {
   nsresult rv = GetDatabase();
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1361,17 +1361,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Mark
 
     rv = msgStore->ChangeFlags(messages, nsMsgMessageFlags::Read, true);
     if (NS_FAILED(rv))
       break;
 
     mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
   } while (false);
 
-  nsMemory::Free(thoseMarked);
+  free(thoseMarked);
   return rv;
 }
 
 nsresult
 nsMsgLocalMailFolder::InitCopyState(nsISupports* aSupport,
                                     nsIArray* messages,
                                     bool isMove,
                                     nsIMsgCopyServiceListener* listener,
--- a/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeHtmlEmitter.cpp
@@ -297,17 +297,17 @@ nsMimeHtmlDisplayEmitter::EndHeader(cons
       {
         int32_t bufLen = strlen(subject) + 16;
         char *buf = new char[bufLen];
         if (!buf)
           return NS_ERROR_OUT_OF_MEMORY;
         PR_snprintf(buf, bufLen, "<title>%s</title>", subject);
         UtilityWriteCRLF(buf);
         delete [] buf;
-        nsMemory::Free(subject);
+        free(subject);
       }
     }
 
     // Stylesheet info!
     UtilityWriteCRLF("<link rel=\"important stylesheet\" href=\"chrome://messagebody/skin/messageBody.css\">");
 
     UtilityWriteCRLF("</head>");
     UtilityWriteCRLF("<body>");
--- a/mailnews/mime/src/mimehdrs.cpp
+++ b/mailnews/mime/src/mimehdrs.cpp
@@ -703,17 +703,17 @@ MimeHeaders_get_name(MimeHeaders *hdrs, 
     PR_Free(s);
   }
 
   if (! name)
   {
     s = MimeHeaders_get(hdrs, HEADER_CONTENT_TYPE, false, false);
     if (s)
     {
-      nsMemory::Free(charset);
+      free(charset);
 
       name = MimeHeaders_get_parameter(s, HEADER_PARM_NAME, &charset, NULL);
       PR_Free(s);
     }
   }
 
   if (! name)
     name = MimeHeaders_get (hdrs, HEADER_CONTENT_NAME, false, false);
@@ -730,17 +730,17 @@ MimeHeaders_get_name(MimeHeaders *hdrs, 
     */
     MIME_StripContinuations(name);
 
     /* Argh. What we should do if we want to be robust is to decode qtext
        in all appropriate headers. Unfortunately, that would be too scary
        at this juncture. So just decode qtext/mime2 here. */
     cvt = mime_decode_filename(name, charset, opt);
 
-    nsMemory::Free(charset);
+    free(charset);
 
     if (cvt && cvt != name)
     {
       PR_Free(name);
       name = cvt;
     }
   }
 
--- a/mailnews/mime/src/mimemoz2.cpp
+++ b/mailnews/mime/src/mimemoz2.cpp
@@ -120,17 +120,17 @@ ProcessBodyAsAttachment(MimeObject *obj,
   tmp->m_realType = child->content_type;
   tmp->m_realEncoding = child->encoding;
   disp = MimeHeaders_get(child->headers, HEADER_CONTENT_DISPOSITION, false, false);
   tmp->m_realName.Adopt(MimeHeaders_get_parameter(disp, "name", &charset, NULL));
   if (!tmp->m_realName.IsEmpty())
   {
     char *fname = NULL;
     fname = mime_decode_filename(tmp->m_realName.get(), charset, obj->options);
-    nsMemory::Free(charset);
+    free(charset);
     if (fname)
       tmp->m_realName.Adopt(fname);
   }
   else
   {
     tmp->m_realName.Adopt(MimeHeaders_get_name(child->headers, obj->options));
 
     if (tmp->m_realName.IsEmpty() &&
@@ -340,32 +340,32 @@ GenerateAttachmentData(MimeObject *objec
   char *disp = MimeHeaders_get(object->headers, HEADER_CONTENT_DISPOSITION, false, false);
   if (disp)
   {
     tmp->m_realName.Adopt(MimeHeaders_get_parameter(disp, "filename", &charset, nullptr));
     if (isAnAppleDoublePart)
       for (i = 0; i < 2 && tmp->m_realName.IsEmpty(); i ++)
       {
         PR_FREEIF(disp);
-        nsMemory::Free(charset);
+        free(charset);
         disp = MimeHeaders_get(((MimeContainer *)object)->children[i]->headers, HEADER_CONTENT_DISPOSITION, false, false);
         tmp->m_realName.Adopt(MimeHeaders_get_parameter(disp, "filename", &charset, nullptr));
       }
 
     if (!tmp->m_realName.IsEmpty())
     {
       // check encoded type
       //
       // The parameter of Content-Disposition must use RFC 2231.
       // But old Netscape 4.x and Outlook Express etc. use RFC2047.
       // So we should parse both types.
 
       char *fname = nullptr;
       fname = mime_decode_filename(tmp->m_realName.get(), charset, options);
-      nsMemory::Free(charset);
+      free(charset);
 
       if (fname)
         tmp->m_realName.Adopt(fname);
     }
 
     PR_FREEIF(disp);
   }
 
@@ -378,17 +378,17 @@ GenerateAttachmentData(MimeObject *objec
     if (tmp->m_realName.IsEmpty())
     {
       tmp->m_realName.Adopt(MimeHeaders_get_parameter(disp, "name", &charset, nullptr));
       if (isAnAppleDoublePart)
         // the data fork is the 2nd part, and we should ALWAYS look there first for the file name
         for (i = 1; i >= 0 && tmp->m_realName.IsEmpty(); i --)
         {
           PR_FREEIF(disp);
-          nsMemory::Free(charset);
+          free(charset);
           disp = MimeHeaders_get(((MimeContainer *)object)->children[i]->headers, HEADER_CONTENT_TYPE, false, false);
           tmp->m_realName.Adopt(MimeHeaders_get_parameter(disp, "name", &charset, nullptr));
           tmp->m_realType.Adopt(
             MimeHeaders_get(((MimeContainer *)object)->children[i]->headers,
                             HEADER_CONTENT_TYPE, true, false));
         }
 
       if (!tmp->m_realName.IsEmpty())
@@ -396,17 +396,17 @@ GenerateAttachmentData(MimeObject *objec
         // check encoded type
         //
         // The parameter of Content-Disposition must use RFC 2231.
         // But old Netscape 4.x and Outlook Express etc. use RFC2047.
         // So we should parse both types.
 
         char *fname = nullptr;
         fname = mime_decode_filename(tmp->m_realName.get(), charset, options);
-        nsMemory::Free(charset);
+        free(charset);
 
         if (fname)
           tmp->m_realName.Adopt(fname);
       }
     }
     PR_FREEIF(disp);
   }
 
--- a/mailnews/mime/src/modlmime.h
+++ b/mailnews/mime/src/modlmime.h
@@ -87,17 +87,17 @@ extern char *MimeHeaders_get(MimeHeaders
 
    Returns NULL if there is no match, or if there is an allocation failure.
 
    RFC2231 - MIME Parameter Value and Encoded Word Extensions: Character Sets,
    Languages, and Continuations
 
    RFC2231 has added the character sets, languages, and continuations mechanism.
    charset, and language information may also be returned to the caller.
-   Note that charset and language should be nsMemory::Free()'d while
+   Note that charset and language should be free()'d while
    the return value (parameter) has to be PR_FREE'd.
 
    For example,
    MimeHeaders_get_parameter("text/plain; name*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A", "name")
    MimeHeaders_get_parameter("text/plain; name*0*=us-ascii'en-us'This%20is%20; CRLFLWSPname*1*=%2A%2A%2Afun%2A%2A%2A", "name")
    would return "This is ***fun***" and *charset = "us-ascii", *language = "en-us"
  */
 extern char *MimeHeaders_get_parameter (const char *header_value,