1341238 - Don't hang on to pointer from temporary NS_LossyConvertUTF16toASCII.

master
Fedor 2020-03-12 20:39:54 +03:00
parent 6b9ec91973
commit 7fd3f667aa
1 changed files with 4 additions and 5 deletions

View File

@ -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()