Closed Bug 586648 Opened 10 years ago Closed 9 years ago

NS_NewXHTMLParanoidFragmentSink should call nsXHTMLParanoidFragmentSink::Init before allocating it

Categories

(Core :: XML, 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_NewXHTMLParanoidFragmentSink(nsIFragmentContentSink** aResult)
 {
   nsXHTMLParanoidFragmentSink* it = new nsXHTMLParanoidFragmentSink();
   if (!it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
   nsresult rv = nsXHTMLParanoidFragmentSink::Init();
leaks it:
   NS_ENSURE_SUCCESS(rv, rv);
   NS_ADDREF(*aResult = it);
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #465233 - Flags: review?(Olli.Pettay)
Comment on attachment 465233 [details] [diff] [review]
patch

new is infallible. Remove the null check if something.
Attachment #465233 - Flags: review?(Olli.Pettay) → review-
Attached patch less codeSplinter Review
Attachment #465233 - Attachment is obsolete: true
Attachment #466575 - Flags: review?(Olli.Pettay)
Attachment #466575 - Flags: review?(Olli.Pettay) → review+
Attachment #466575 - Flags: approval2.0?
Comment on attachment 466575 [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 #466575 - Flags: approval2.0? → approval2.0-
http://hg.mozilla.org/mozilla-central/rev/0c3b638b4977
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.