Bug 1020432 - Leak of |buf| in nsAuthSambaNTLM::GetNextToken, r=honzab
authorNochum Sossonko <highmind63@gmail.com>
Sun, 22 Jun 2014 11:10:08 -0700
changeset 189961 35c527229cdba117043ea9878c7399773dee8902
parent 189960 e3ab11ba56a5f9ddbbf83cfbdbdedcbe53660eae
child 189962 efaa172c0ee49833d298df1ab6f1af5f779dc236
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewershonzab
bugs1020432
milestone33.0a1
Bug 1020432 - Leak of |buf| in nsAuthSambaNTLM::GetNextToken, r=honzab
extensions/auth/nsAuthSambaNTLM.cpp
--- a/extensions/auth/nsAuthSambaNTLM.cpp
+++ b/extensions/auth/nsAuthSambaNTLM.cpp
@@ -260,18 +260,18 @@ nsAuthSambaNTLM::GetNextToken(const void
         // 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 has to be freed by nsMemory::Free, which may not be free() 
     *outToken = nsMemory::Clone(buf, *outTokenLen);
+    free(buf);
     if (!*outToken) {
-        free(buf);
         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;
 }