Fixes free memory read

Bug 113917 r=rods sr=dbaron
This commit is contained in:
rods%netscape.com 2002-01-07 13:31:18 +00:00
parent c13593de3c
commit 5b82204613
2 changed files with 8 additions and 12 deletions

View File

@ -555,13 +555,11 @@ nsSimplePageSequenceFrame::SetPageNumberFormat(const char* aPropName, const char
// Doing this here so we only have to go get these formats once
nsAutoString pageNumberFormat;
// Now go get the Localized Page Formating String
const PRUnichar* uPropName = NS_ConvertUTF8toUCS2(aPropName).get();
if (uPropName != nsnull) {
nsresult rv = nsFormControlHelper::GetLocalizedString(PRINTING_PROPERTIES, uPropName, pageNumberFormat);
if (NS_FAILED(rv)) { // back stop formatting
pageNumberFormat.AssignWithConversion(aDefPropVal);
}
nsresult rv = nsFormControlHelper::GetLocalizedString(PRINTING_PROPERTIES, NS_ConvertUTF8toUCS2(aPropName).get(), pageNumberFormat);
if (NS_FAILED(rv)) { // back stop formatting
pageNumberFormat.AssignWithConversion(aDefPropVal);
}
// Sets the format into a static data memeber which will own the memory and free it
PRUnichar* uStr = ToNewUnicode(pageNumberFormat);
if (uStr != nsnull) {

View File

@ -555,13 +555,11 @@ nsSimplePageSequenceFrame::SetPageNumberFormat(const char* aPropName, const char
// Doing this here so we only have to go get these formats once
nsAutoString pageNumberFormat;
// Now go get the Localized Page Formating String
const PRUnichar* uPropName = NS_ConvertUTF8toUCS2(aPropName).get();
if (uPropName != nsnull) {
nsresult rv = nsFormControlHelper::GetLocalizedString(PRINTING_PROPERTIES, uPropName, pageNumberFormat);
if (NS_FAILED(rv)) { // back stop formatting
pageNumberFormat.AssignWithConversion(aDefPropVal);
}
nsresult rv = nsFormControlHelper::GetLocalizedString(PRINTING_PROPERTIES, NS_ConvertUTF8toUCS2(aPropName).get(), pageNumberFormat);
if (NS_FAILED(rv)) { // back stop formatting
pageNumberFormat.AssignWithConversion(aDefPropVal);
}
// Sets the format into a static data memeber which will own the memory and free it
PRUnichar* uStr = ToNewUnicode(pageNumberFormat);
if (uStr != nsnull) {