Bug 1366882 - Fix a resource leak - CID 1213977 - r?froydnj draft
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 22 May 2017 23:00:10 +0200
changeset 583826 a57b497ec68cd3737944c459b3ed621b5b837538
parent 583825 018e3bd6f00b1a35ce74fe6cffbfef32c4914242
child 583827 1208810af4397a5fd0a1a27cfb3d137f335bde1b
push id60571
push userbmo:sledru@mozilla.com
push dateWed, 24 May 2017 18:10:53 +0000
reviewersfroydnj
bugs1366882, 1213977
milestone55.0a1
Bug 1366882 - Fix a resource leak - CID 1213977 - r?froydnj MozReview-Commit-ID: 7Af5BXxaIZl
intl/uconv/nsTextToSubURI.cpp
--- a/intl/uconv/nsTextToSubURI.cpp
+++ b/intl/uconv/nsTextToSubURI.cpp
@@ -124,16 +124,17 @@ NS_IMETHODIMP  nsTextToSubURI::UnEscapeA
   if (nullptr == unescaped)
     return NS_ERROR_OUT_OF_MEMORY;
   unescaped = nsUnescape(unescaped);
   NS_ASSERTION(unescaped, "nsUnescape returned null");
 
   nsDependentCString label(charset);
   nsAutoCString encoding;
   if (!EncodingUtils::FindEncodingForLabelNoReplacement(label, encoding)) {
+    free(unescaped);
     return NS_ERROR_UCONV_NOCONV;
   }
   nsCOMPtr<nsIUnicodeDecoder> decoder =
     EncodingUtils::DecoderForEncoding(encoding);
   char16_t *pBuf = nullptr;
   int32_t len = strlen(unescaped);
   int32_t outlen = 0;
   if (NS_SUCCEEDED(rv = decoder->GetMaxLength(unescaped, len, &outlen))) {