Bug 1366882 - Fix a resource leak - CID 1213977 - r=froydnj
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 22 May 2017 23:00:10 +0200
changeset 413319 365687db6288738e30dd76d926790e1cd16df651
parent 413318 021d3649e2fcc1b017b9cedb3bd10f7cc08ad33d
child 413320 2ec004b70daae60449d9fb91280d170bd0178196
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1366882, 1213977
milestone55.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 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))) {