Bug 1449358 - Consistently use PR memory functions. r=mayhemer
authorAlex Gaynor <agaynor@mozilla.com>
Tue, 17 Apr 2018 10:14:20 -0400
changeset 414739 b876ed208711bc346d7ca95b0599f6e4eb02ff2e
parent 414738 983b15929e0424b2346df3d39af2d352ed4db0b9
child 414740 131166cff47d79cdc09dd89a5a7d5d4ec9af6a75
push id102415
push userryanvm@gmail.com
push dateFri, 20 Apr 2018 20:15:44 +0000
treeherdermozilla-inbound@b876ed208711 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1449358
milestone61.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 1449358 - Consistently use PR memory functions. r=mayhemer
extensions/auth/nsAuthSambaNTLM.cpp
--- a/extensions/auth/nsAuthSambaNTLM.cpp
+++ b/extensions/auth/nsAuthSambaNTLM.cpp
@@ -1,16 +1,17 @@
 /* vim:set ts=4 sw=4 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsAuth.h"
 #include "nsAuthSambaNTLM.h"
 #include "nsMemory.h"
+#include "nspr.h"
 #include "prenv.h"
 #include "plbase64.h"
 #include "prerror.h"
 #include "mozilla/Telemetry.h"
 
 #include <stdlib.h>
 
 nsAuthSambaNTLM::nsAuthSambaNTLM()
@@ -19,17 +20,17 @@ nsAuthSambaNTLM::nsAuthSambaNTLM()
 {
 }
 
 nsAuthSambaNTLM::~nsAuthSambaNTLM()
 {
     // ntlm_auth reads from stdin regularly so closing our file handles
     // should cause it to exit.
     Shutdown();
-    free(mInitialMessage);
+    PR_Free(mInitialMessage);
 }
 
 void
 nsAuthSambaNTLM::Shutdown()
 {
     if (mFromChildFD) {
         PR_Close(mFromChildFD);
         mFromChildFD = nullptr;
@@ -244,34 +245,34 @@ nsAuthSambaNTLM::GetNextToken(const void
     /* inToken must be a type 2 message. Get ntlm_auth to generate our response */
     char* encoded = PL_Base64Encode(static_cast<const char*>(inToken), inTokenLen, nullptr);
     if (!encoded)
         return NS_ERROR_OUT_OF_MEMORY;
 
     nsCString request;
     request.AssignLiteral("TT ");
     request.Append(encoded);
-    free(encoded);
+    PR_Free(encoded);
     request.Append('\n');
 
     if (!WriteString(mToChildFD, request))
         return NS_ERROR_FAILURE;
     nsCString line;
     if (!ReadLine(mFromChildFD, line))
         return NS_ERROR_FAILURE;
     if (!StringBeginsWith(line, NS_LITERAL_CSTRING("KK ")) &&
         !StringBeginsWith(line, NS_LITERAL_CSTRING("AF "))) {
         // Something went wrong. Perhaps no credentials are accessible.
         return NS_ERROR_FAILURE;
     }
     uint8_t* buf = ExtractMessage(line, outTokenLen);
     if (!buf)
         return NS_ERROR_FAILURE;
     *outToken = nsMemory::Clone(buf, *outTokenLen);
-    free(buf);
+    PR_Free(buf);
     if (!*outToken) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     // We're done. Close our file descriptors now and reap the helper
     // process.
     Shutdown();
     return NS_SUCCESS_AUTH_FINISHED;