Closed Bug 586650 Opened 9 years ago Closed 9 years ago

txFnStartOutput leaks qname when qname->init fails

Categories

(Core :: XSLT, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, memory-leak)

Attachments

(1 file, 1 obsolete file)

1.02 KB, patch
timeless
: review+
sicking
: approval2.0+
Details | Diff | Splinter Review
txExpandedName* qname = new txExpandedName();
             NS_ENSURE_TRUE(qname, NS_ERROR_OUT_OF_MEMORY);
 
             rv = qname->init(tokens.nextToken(),
                              aState.mElementContext->mMappings, PR_FALSE);
leaks qname:
             NS_ENSURE_SUCCESS(rv, rv);
 
             rv = item->mFormat.mCDATASectionElements.add(qname);
leaks qname:
             NS_ENSURE_SUCCESS(rv, rv);
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #465235 - Flags: review?(jonas)
Comment on attachment 465235 [details] [diff] [review]
patch

Please use

nsAutoPtr<...> qname = new ...;
....
rv = item->mFormat.mCDATASectionElements.add(qname);
NS_ENSURE_SUCCESS(rv, rv);

qname.forget();



to keep the code more readable. r=me with that change. Also, in the future, please include more context in your patches. -u8 is a pretty good number.
Attachment #465235 - Flags: review?(jonas) → review+
Attached patch autoptrSplinter Review
Attachment #465235 - Attachment is obsolete: true
Attachment #465340 - Flags: review+
Attachment #465340 - Flags: approval2.0?
Keywords: checkin-needed
Pushed http://hg.mozilla.org/mozilla-central/rev/048f8f89152b
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.