summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-12-22 17:19:21 -0500
committerGaming4JC <g4jc@hyperbola.info>2019-12-22 17:20:23 -0500
commit4e6294b248390e60e1a39eef4cebff3c288dd7a6 (patch)
treec800fd84e35dd5749c69aad87f8f0d503331e1f0 /dom
parent492624a7106ecbc18994b465ca1dd23fa472bf7e (diff)
downloadUXP-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')
-rw-r--r--dom/media/CubebUtils.cpp9
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()