Closed Bug 464159 Opened 16 years ago Closed 15 years ago

Quickstubs leaks IIDs

Categories

(Core :: DOM: Core & HTML, defect, P2)

x86
Linux
defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: sayrer, Assigned: sayrer)

Details

(Keywords: fixed1.9.1)

Attachments

(1 file, 1 obsolete file)

LookupInterfaceOrAncestor needs to free the variable "piid"
Attached patch obvious patch (obsolete) — Splinter Review
valgrind says this fixes most of the leaks, but not all. That's confusing, because I'm not sure how it could still leak.
Attachment #347467 - Flags: review?(jorendorff)
I think valgrind is right.  GetInterfaceIID is called within the loop, so it could be called several times.  So the Free call needs to be inside the loop as well, right?

             if(NS_FAILED(info->GetParent(getter_AddRefs(parent))) ||
                !parent ||
                NS_FAILED(parent->GetInterfaceIID(&piid)))
             {
                 break;
             }
             p = LookupEntry(tableSize, table, *piid);
+            nsMemory::Free(piid);
             if(p)
                 break;

No need to initialize piid to null; it could be moved inside the loop though.

Also feel free to rename "p" to "entry" or something.  I don't know what I was thinking.  :-\
Or better yet, use GetIIDShared and avoid the allocation/free pair altogether.
(In reply to comment #2)
> I think valgrind is right.  GetInterfaceIID is called within the loop, so it
> could be called several times.  So the Free call needs to be inside the loop as
> well, right?

Oh, duh, yeah. I'll get something going incorporating Benjamin's suggestion.
Attachment #347467 - Flags: review?(jorendorff)
Attached patch use GetIIDSharedSplinter Review
Attachment #347467 - Attachment is obsolete: true
Attachment #348237 - Flags: review?(jorendorff)
Comment on attachment 348237 [details] [diff] [review]
use GetIIDShared

Looks good.
Attachment #348237 - Flags: review?(jorendorff) → review+
Attachment #348237 - Flags: approval1.9.1?
Attachment #348237 - Flags: approval1.9.1? → approval1.9.1+
Comment on attachment 348237 [details] [diff] [review]
use GetIIDShared

a191=beltzner
http://hg.mozilla.org/mozilla-central/rev/c78fb7914c0c
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Flags: blocking1.9.1+
Priority: -- → P2
Assignee: nobody → sayrer
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: