From dc498142732d510ad5be0bf2a4b485d252f705a4 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 24 May 2017 19:39:26 +0200 Subject: [PATCH] Bug 1366882 - Fix a resource leak - CID 1402588 r=erahm MozReview-Commit-ID: Al0Vlxewy0V --HG-- extra : rebase_source : dd7c0af4dbec25d642e6cc0a71d53a207f5aca11 --- extensions/auth/nsHttpNegotiateAuth.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/auth/nsHttpNegotiateAuth.cpp b/extensions/auth/nsHttpNegotiateAuth.cpp index 4131e4714d83..1f7f241cade1 100644 --- a/extensions/auth/nsHttpNegotiateAuth.cpp +++ b/extensions/auth/nsHttpNegotiateAuth.cpp @@ -525,7 +525,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne // unsigned int len = strlen(challenge); - void *inToken, *outToken; + void *inToken = nullptr, *outToken; uint32_t inTokenLen, outTokenLen; if (len > kNegotiateLen) { @@ -545,6 +545,7 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne Base64Decode(challenge, len, (char**)&inToken, &inTokenLen); if (NS_FAILED(rv)) { + free(inToken); return rv; } } @@ -552,7 +553,6 @@ nsHttpNegotiateAuth::GenerateCredentials(nsIHttpAuthenticableChannel *authChanne // // Initializing, don't use an input token. // - inToken = nullptr; inTokenLen = 0; }