Bug 1263503 - memory leak of filename into layout/printing/nsPrintEngine.cpp. r?mantaroh
"fileNameStr = fileName;" will be fileNameStr.Assign(fileName), so this causes small memory leak. We should use Adopt, getter_copies, or AString parameter instead.
MozReview-Commit-ID: 5VTgttj2LdK
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -1842,19 +1842,17 @@ nsPrintEngine::SetupToPrintContent()
}
nsAutoString fileNameStr;
// check to see if we are printing to a file
bool isPrintToFile = false;
printData->mPrintSettings->GetPrintToFile(&isPrintToFile);
if (isPrintToFile) {
// On some platforms The BeginDocument needs to know the name of the file.
- char16_t* fileName = nullptr;
- printData->mPrintSettings->GetToFileName(&fileName);
- fileNameStr = fileName;
+ printData->mPrintSettings->GetToFileName(getter_Copies(fileNameStr));
}
nsAutoString docTitleStr;
nsAutoString docURLStr;
GetDisplayTitleAndURL(printData->mPrintObject, docTitleStr, docURLStr,
eDocTitleDefURLDoc);
int32_t startPage = 1;