nsObserverList::GetObserverList should return OOM on failure

RESOLVED FIXED

Status

()

RESOLVED FIXED
15 years ago
15 years ago

People

(Reporter: timeless, Assigned: timeless)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

15 years ago
consider this call chain:
nsObserverService::NotifyObservers
nsObserverService::EnumerateObservers
nsObserverService::GetObserverList
nsObserverList::GetObserverList

139     ObserverListEnumerator * enumerator= new
ObserverListEnumerator(mObserverList);
140     NS_IF_ADDREF(enumerator);
141     *anEnumerator = enumerator;
142     return NS_OK;

let new fail.
anEnumerator = 0
return NS_OK

this bubbles to 
199     rv = EnumerateObservers( aTopic, getter_AddRefs(observers) );
200     if ( NS_FAILED( rv ) )
false, so skip return
201         return rv;

203     while( NS_SUCCEEDED(observers->HasMoreElements(&loop)) && loop) 
null, so crash.
(Assignee)

Comment 1

15 years ago
Created attachment 144945 [details] [diff] [review]
return failure
(Assignee)

Updated

15 years ago
Attachment #144945 - Flags: review?(dougt)

Updated

15 years ago
Attachment #144945 - Flags: review?(dougt) → review+
(Assignee)

Comment 2

15 years ago
mozilla/xpcom/ds/nsObserverList.cpp 	3.31
Status: NEW → RESOLVED
Last Resolved: 15 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.