Closed Bug 586606 Opened 9 years ago Closed 9 years ago

NS_NewHTMLParanoidFragmentSink should nsHTMLParanoidFragmentSink::Init before allocating

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file, 1 obsolete file)

NS_NewHTMLParanoidFragmentSink(nsIFragmentContentSink** aResult)
 {
   nsHTMLParanoidFragmentSink* it = new nsHTMLParanoidFragmentSink();
   if (!it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   nsresult rv = nsHTMLParanoidFragmentSink::Init();
leaks it:
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ADDREF(*aResult = it);
   
   return NS_OK;
 }
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #465178 - Flags: review?(Olli.Pettay)
Comment on attachment 465178 [details] [diff] [review]
patch

new is infallible. Just remove the null check.
Attachment #465178 - Flags: review?(Olli.Pettay) → review-
Attached patch less codeSplinter Review
Attachment #465178 - Attachment is obsolete: true
Attachment #466573 - Flags: review?(Olli.Pettay)
Attachment #466573 - Flags: review?(Olli.Pettay) → review+
Attachment #466573 - Flags: approval2.0?
Comment on attachment 466573 [details] [diff] [review]
less code

Mass minusing patch approval that don't have high return. Please renominate if this is more important for 2.0 than it appears.
Attachment #466573 - Flags: approval2.0? → approval2.0-
http://hg.mozilla.org/mozilla-central/rev/85eb53e80ce1
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: fixed-in-cedar
Target Milestone: --- → mozilla2.2
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.