Closed Bug 255710 Opened 22 years ago Closed 22 years ago

nsDocShell::GetDocShellEnumerator leaks docShellEnum in failure cases

Categories

(Core :: DOM: Navigation, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla1.8alpha4

People

(Reporter: timeless, Assigned: csthomas)

References

()

Details

(Keywords: memory-leak)

Attachments

(1 file, 1 obsolete file)

a do {} while (0) loop could be used, otherwise something will have to manage that pointer...
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8alpha4
Attachment #156218 - Flags: superreview?(jst)
Attachment #156218 - Flags: review?(darin)
Comment on attachment 156218 [details] [diff] [review] patch v1 >Index: nsDocShell.cpp > nsDocShellEnumerator* docShellEnum; > if (aDirection == ENUMERATE_FORWARDS) > docShellEnum = new nsDocShellForwardsEnumerator; > else > docShellEnum = new nsDocShellBackwardsEnumerator; > > if (!docShellEnum) return NS_ERROR_OUT_OF_MEMORY; > >+ nsCOMPtr<nsISupports> docShellEnumPtr(docShellEnum); you could also just change the declaration of docShellEnum to: nsRefPtr<nsDocShellEnumerator> docShellEnum; nsRefPtr is just like nsCOMPtr except that it can be used with concrete class pointers.
Attached patch Patch v2Splinter Review
Attachment #156218 - Attachment is obsolete: true
Attachment #156218 - Flags: superreview?(jst)
Attachment #156218 - Flags: review?(darin)
Attachment #156307 - Flags: superreview?(jst)
Attachment #156307 - Flags: review?(darin)
Comment on attachment 156307 [details] [diff] [review] Patch v2 sr=jst
Attachment #156307 - Flags: superreview?(jst) → superreview+
Attachment #156307 - Flags: review?(darin) → review+
Timeless checked in the patch.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Keywords: mlk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: