imgRequest::Init should manage observer more carefully

RESOLVED FIXED in mozilla2.0b10

Status

()

defect
RESOLVED FIXED
9 years ago
Last year

People

(Reporter: timeless, Assigned: timeless)

Tracking

(Blocks 1 bug, {coverity, memory-leak})

Trunk
mozilla2.0b10
x86
Windows 7
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

()

Attachments

(1 attachment, 1 obsolete attachment)

1.48 KB, patch
timeless
: review+
Details | Diff | Splinter Review
Assignee

Description

9 years ago
205 nsresult imgRequest::Init(nsIURI *aURI,

243   if (NS_UNLIKELY(!gRegisteredPrefObserver)) {

this should be done after getting branch in order to avoid leaking it:
244     imgRequestPrefObserver *observer = new imgRequestPrefObserver();
245     if (observer) {
246       nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
247       if (branch) {
253       }
254     }
this makes no sense:
255     else
256       delete observer;
257   }
Assignee

Comment 1

9 years ago
Posted patch patch (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #498302 - Flags: review?(bobbyholley+bmo)
Attachment #498302 - Flags: approval2.0?
Attachment #498302 - Flags: review?(bobbyholley+bmo) → review?(joe)
Comment on attachment 498302 [details] [diff] [review]
patch

Drop the "if(observer)" - new is infallible.
Attachment #498302 - Flags: review?(joe)
Attachment #498302 - Flags: review+
Attachment #498302 - Flags: approval2.0?
Attachment #498302 - Flags: approval2.0+
Assignee

Comment 3

9 years ago
Posted patch patchSplinter Review
Attachment #498302 - Attachment is obsolete: true
Attachment #502357 - Flags: review+
Assignee

Updated

9 years ago
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.