[W] MLK: Memory leak of 34 bytes from 2 blocks allocated in PL_strdup

VERIFIED DUPLICATE of bug 132126

Status

()

Core
XPCOM
VERIFIED DUPLICATE of bug 132126
16 years ago
16 years ago

People

(Reporter: Navin Gupta, Assigned: dougt)

Tracking

({helpwanted})

Trunk
Future
x86
Windows NT
helpwanted
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

16 years ago
Steps to reproduce

1) Launch mail
2) read message, switch folders
2) Compose and send a message
3) quit

        Distribution of leaked blocks
        Allocation location
            malloc         [dbgheap.c:129]
            PL_strdup      [strdup.c:46]
            nsCRT::strdup(char const*) [nsCRT.h:182]
            nsFactoryEntry::ReInit(nsID const&,char const*,int) 
[nsComponentManager.cpp:430]
                    // SERVICE_ONLY entries can be promoted to an entry of 
another type
                    NS_ENSURE_TRUE((typeIndex == NS_COMPONENT_TYPE_SERVICE_ONLY 
|| cid.Equals(aClass)),
                                   NS_ERROR_INVALID_ARG);
             =>     location = nsCRT::strdup(aLocation);
                    typeIndex = aType;
                    return NS_OK;
                }
            nsComponentManagerImpl::RegisterComponentCommon(nsID const&,char 
const*,char const*,char const*,int,int,char const*) 
[nsComponentManager.cpp:2390]
                    }
                
                    if (entry) {
             =>         entry->ReInit(aClass, aRegistryName, typeIndex);
                    }
                    else {
                        entry = new nsFactoryEntry(aClass, aRegistryName, 
typeIndex);
            nsComponentManagerImpl::RegisterComponentWithType(nsID const&,char 
const*,char const*,nsIFile *,char const*,int,int,char const*) 
[nsComponentManager.cpp:2273]
            nsComponentManagerImpl::RegisterComponentSpec(nsID const&,char 
const*,char const*,nsIFile *,int,int) [nsComponentManager.cpp:2295]
            nsPluginHostImpl::RegisterPluginMimeTypesWithLayout(nsPluginTag 
*,nsIComponentManager *,nsIFile *) [nsPluginHostImpl.cpp:3542]
            nsPluginHostImpl::ScanPluginsDirectory(nsIFile *,nsIComponentManager 
*,nsIFile *,int) [nsPluginHostImpl.cpp:4541]
            nsPluginHostImpl::LoadPlugins(void) [nsPluginHostImpl.cpp:4654]

Comment 1

16 years ago
--> XPCOM Registry?
Assignee: av → dougt
Component: Plug-ins → XPCOM Registry
QA Contact: shrir → dougt
(Assignee)

Updated

16 years ago
Component: XPCOM Registry → XPCOM
Target Milestone: --- → mozilla0.9.7
(Assignee)

Updated

16 years ago
Keywords: helpwanted
Target Milestone: mozilla0.9.7 → Future
QA Contact: dougt → stephend

Comment 2

16 years ago
Created attachment 69990 [details] [diff] [review]
Patch to avoid dropping the old reference.

From just reading the code:

If ReInit() gets called more than once it will just do:
|location = nsCRT::strdup(aLocation)|
thus dropping the old reference on the floor. This patch makes it free it if it
is allocated before trying to strdup() again. 

Am I missing something in the big picture?

Comment 3

16 years ago
Would neeti or dp care to make a comment about the fix? Those are the two names
that show up in cvsblame around the code.
(Assignee)

Comment 4

16 years ago
Comment on attachment 69990 [details] [diff] [review]
Patch to avoid dropping the old reference.

r=dougt
Attachment #69990 - Flags: review+

Comment 5

16 years ago
ah! I remember typing a comment on this bug. Maybe I wasnt logged in and got the
login screen instead of an add to the bug.

The plan is to arena allocate location. Longer term plan is to store a hash
instead of the string.

Yeah good fixing this leak. But bug 130381 will obsolete this fix as it will
arena allocate the location string. I am waiting on approval to check it in.

Comment 6

16 years ago
Bug 132126 contains an identical patch to this one that was checked in on trunk
today. This bug should probably be marked as a dupe of that.

Comment 7

16 years ago

*** This bug has been marked as a duplicate of 132126 ***
Status: NEW → RESOLVED
Last Resolved: 16 years ago
Resolution: --- → DUPLICATE
vrfy, sorry for filing the duplicate, but this bug was unfindable given the summary.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.