Bug 1366882 - Fix a resource leak - CID 1213977 - r?froydnj
MozReview-Commit-ID: 7Af5BXxaIZl
--- 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))) {