Closed Bug 338677 Opened 18 years ago Closed 18 years ago

nsUrlClassifierDBService leaks memory

Categories

(Toolkit :: Safe Browsing, defect)

2.0 Branch
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: tony, Assigned: tony)

References

Details

(Keywords: fixed1.8.1)

Attachments

(2 files, 2 obsolete files)

mConnection and gEventQ are regular pointers so they need manual release.

We also don't release the reference to the thread queue from mWorker when we're done with it.
Attached patch v1: patch for branch (obsolete) — Splinter Review
This is for branch; I'm working on a patch for trunk.
Attachment #222744 - Flags: review?(darin)
Attached patch v1: patch for trunk (obsolete) — Splinter Review
Attachment #222756 - Flags: review?(darin)
Comment on attachment 222756 [details] [diff] [review]
v1: patch for trunk

>Index: nsUrlClassifierDBService.cpp

> nsUrlClassifierDBServiceWorker::CloseDb()
> {
>   if (mConnection != nsnull) {
>+    NS_RELEASE(mConnection);
>     delete mConnection;
>     mConnection = nsnull;

So, NS_RELEASE(x) will null out |x| as a side-effect.  That means that
|delete x| and |x = nsnull| will both be no-ops, so they should be 
removed.  Besides, I don't think you meant to delete this object! :)


>   gDbBackgroundThread->Shutdown();
>   NS_RELEASE(gDbBackgroundThread);
>+  gDbBackgroundThread = nsnull;

No need for explicit nulling here.


r=darin with those nits picked
Attachment #222756 - Flags: review?(darin) → review+
remove extra delete and null
Attachment #222744 - Attachment is obsolete: true
Attachment #222744 - Flags: review?(darin)
Attachment #222906 - Flags: review+
Attachment #222906 - Flags: approval-branch-1.8.1+
extra null assignment removed
Attachment #222756 - Attachment is obsolete: true
fixed-on-trunk, fixed1.8.1
Status: NEW → RESOLVED
Closed: 18 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: