From 4e6294b248390e60e1a39eef4cebff3c288dd7a6 Mon Sep 17 00:00:00 2001 From: Gaming4JC Date: Sun, 22 Dec 2019 17:19:21 -0500 Subject: Bug 1341238 - Don't hang on to pointer from temporary NS_LossyConvertUTF16toASCII. Resolves #1333 --- dom/media/CubebUtils.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dom/media/CubebUtils.cpp b/dom/media/CubebUtils.cpp index 0f0167d9c..6bb846afe 100644 --- a/dom/media/CubebUtils.cpp +++ b/dom/media/CubebUtils.cpp @@ -203,11 +203,10 @@ void InitBrandName() NS_SUCCEEDED(rv), "Could not get the program name for a cubeb stream."); } } - /* cubeb expects a c-string. */ - const char* ascii = NS_LossyConvertUTF16toASCII(brandName).get(); - sBrandName = new char[brandName.Length() + 1]; - PodCopy(sBrandName.get(), ascii, brandName.Length()); - sBrandName[brandName.Length()] = 0; + NS_LossyConvertUTF16toASCII ascii(brandName); + sBrandName = new char[ascii.Length() + 1]; + PodCopy(sBrandName.get(), ascii.get(), ascii.Length()); + sBrandName[ascii.Length()] = 0; } cubeb* GetCubebContextUnlocked() -- cgit v1.2.3