Closed Bug 203764 Opened 21 years ago Closed 18 years ago

Memory leak of 370 bytes from 1 block allocated in copy_environ, due to putenv()/setenv()

Categories

(Core :: XPCOM, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: stephend, Unassigned)

References

Details

(Keywords: memory-leak)

Just starting up the latest trunk win32 debug under Purify with -edit, I see:

    [W] MLK: Memory leak of 370 bytes from 1 block allocated in copy_environ
        Distribution of leaked blocks
        Allocation location
        malloc_dbg     [dbgheap.c:164]
        copy_environ   [setenv.c:335]
        _crtsetenv     [setenv.c:98]
        putenv_lk      [putenv.c:161]
        putenv         [putenv.c:78]
        PR_MD_PUT_ENV  [ntmisc.c:54]
        */
        PRIntn _PR_MD_PUT_ENV(const char *name)
        {
     =>     return(putenv(name));
        }
        
        
    PR_SetEnv      [prenv.c:93]
    nsGREDirServiceProvider::AddGRELocationToPath(void)
[nsGREDirServiceProvider.cpp:490]
                                       XPCOM_SEARCH_KEY,
                                       grePath,
                                       path);
     =>   PR_SetEnv(mPathEnvString);
          free(grePath);
        }
        
    nsGREDirServiceProvider::nsGREDirServiceProvider(void)
[nsGREDirServiceProvider.cpp:86]
        nsGREDirServiceProvider::nsGREDirServiceProvider()
        : mPathEnvString(nsnull)
        {
     =>   AddGRELocationToPath();
        }
        
        nsGREDirServiceProvider::~nsGREDirServiceProvider()
    GRE_Startup    [nsXPCOMGlue.cpp:231]
                return rv;
            }
        
     =>     nsGREDirServiceProvider *provider = new nsGREDirServiceProvider();
            if ( !provider ) {
                NS_WARNING("GRE_Startup failed");
                XPCOMGlueShutdown();
huh. I wonder if this leak is unavoidable, or at least that its a libc leak. it
looks like the system is leaking the data in the putenv(), and I'm guessing the
library is the only one with the capability to fix it.
http://lxr.mozilla.org/nspr/source/nsprpub/pr/include/prenv.h#101

i guess, we could reset the env right before we exit.
Assignee: dougt → nobody
QA Contact: scc → xpcom
I don't know if this is still valid or not...
This is not worth fixing. envvar settings must be static, and doing shutdown resets isn't worth the effort.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WONTFIX
I assume bug 114646 was this bug;
and bug 454842 comment 7 testcase is too...
Blocks: 114646, 454842
Summary: Memory leak of 370 bytes from 1 block allocated in copy_environ → Memory leak of 370 bytes from 1 block allocated in copy_environ, due to putenv()/setenv()
No longer blocks: 541446
You need to log in before you can comment on or make changes to this bug.