diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-12-22 17:19:21 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-12-22 17:20:23 -0500 |
commit | 4e6294b248390e60e1a39eef4cebff3c288dd7a6 (patch) | |
tree | c800fd84e35dd5749c69aad87f8f0d503331e1f0 /dom/media/CubebUtils.cpp | |
parent | 492624a7106ecbc18994b465ca1dd23fa472bf7e (diff) | |
download | UXP-4e6294b248390e60e1a39eef4cebff3c288dd7a6.tar UXP-4e6294b248390e60e1a39eef4cebff3c288dd7a6.tar.gz UXP-4e6294b248390e60e1a39eef4cebff3c288dd7a6.tar.lz UXP-4e6294b248390e60e1a39eef4cebff3c288dd7a6.tar.xz UXP-4e6294b248390e60e1a39eef4cebff3c288dd7a6.zip |
Bug 1341238 - Don't hang on to pointer from temporary NS_LossyConvertUTF16toASCII.
Resolves #1333
Diffstat (limited to 'dom/media/CubebUtils.cpp')
-rw-r--r-- | dom/media/CubebUtils.cpp | 9 |
1 files 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() |