Closed Bug 1263503 Opened 5 years ago Closed 4 years ago

memory leak of filename into layout/printing/nsPrintEngine.cpp

Categories

(Core :: Printing: Output, defect, P4)

1.0 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- wontfix
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- fixed

People

(Reporter: m_kato, Assigned: m_kato)

Details

(Keywords: memory-leak)

Attachments

(1 file)

https://dxr.mozilla.org/mozilla-central/source/layout/printing/nsPrintEngine.cpp#1682

  nsAutoString fileNameStr;
  // check to see if we are printing to a file
  bool isPrintToFile = false;
  mPrt->mPrintSettings->GetPrintToFile(&isPrintToFile);
  if (isPrintToFile) {
    // On some platforms The BeginDocument needs to know the name of the file.
    char16_t* fileName = nullptr;
    mPrt->mPrintSettings->GetToFileName(&fileName);
    fileNameStr = fileName;
  }

"fileNameStr = fileName;" will be fileNameStr.Assign(fileName).  So we should use Adopt, "nsXPIDLString fileNameStr", or AString parameter instead.
Severity: normal → trivial
Keywords: mlk
Priority: -- → P4
Comment on attachment 8906425 [details]
Bug 1263503 - memory leak of filename into layout/printing/nsPrintEngine.cpp.

https://reviewboard.mozilla.org/r/178138/#review183098

Thanks!
Comment on attachment 8906425 [details]
Bug 1263503 - memory leak of filename into layout/printing/nsPrintEngine.cpp.

https://reviewboard.mozilla.org/r/178140/#review183102
Attachment #8906425 - Flags: review?(mantaroh) → review+
Pushed by m_kato@ga2.so-net.ne.jp:
https://hg.mozilla.org/integration/autoland/rev/5ea257c32084
memory leak of filename into layout/printing/nsPrintEngine.cpp. r=mantaroh
https://hg.mozilla.org/mozilla-central/rev/5ea257c32084
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
How severe is this leak? Is this something we should consider backporting to 56 or can it ride the 57 train?
Assignee: nobody → m_kato
Blocks: 1156742
Flags: needinfo?(m_kato)
Version: unspecified → 47 Branch
(In reply to Ryan VanderMeulen [:RyanVM] from comment #6)
> How severe is this leak? Is this something we should consider backporting to
> 56 or can it ride the 57 train?

This is small memory leak and this occurs when using [Print] - [Save as File].  Most users don't use this.
Flags: needinfo?(m_kato)
While I moved the pointer declaration in bug 1156742 (and should have spotted it :-) ), this leak has been there for over 15 years.
No longer blocks: 1156742
Version: 47 Branch → 1.0 Branch
You need to log in before you can comment on or make changes to this bug.