Closed Bug 116427 Opened 23 years ago Closed 23 years ago

MLKs in nsPluginHostImpl.cpp

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: naving, Assigned: naving)

Details

(Keywords: memory-leak)

Attachments

(1 file)

[W] MLK: Memory leak of 491 bytes from 18 blocks allocated in PL_strdup
        Distribution of leaked blocks
        Allocation location
            malloc         [dbgheap.c:129]
            PL_strdup      [strdup.c:46]
            nsCRT::strdup(char const*) [nsCRT.h:182]
            nsRegistry::GetBytesUTF8(UINT,char const*,UINT *,BYTE * *) 
[nsRegistry.cpp:859]
                            if ( err == REGERR_OK )
                            {
                                *length = length2;
             =>                 *result = (PRUint8*)(nsCRT::strdup(regStr));
                                if (!*result)
                                {
                                    rv = NS_ERROR_OUT_OF_MEMORY;
            LoadXPCOMPlugin [nsPluginHostImpl.cpp:4789]
                  aRegistry->GetBytesUTF8(aPluginKey, kPluginsNameKey, &length, 
&name);
                
                  PRUint8 * description=nsnull;
             =>   aRegistry->GetBytesUTF8(aPluginKey, kPluginsDescKey, &length, 
&description);
                
                  nsXPIDLCString filename;
                  nsXPIDLCString fullpath;
            nsPluginHostImpl::LoadCachedPluginsInfo(nsIRegistry *) 
[nsPluginHostImpl.cpp:5107]
                    // in to the mCachedPlugins list.
                    nsRegistryKey key;
                    node->GetKey(&key);
             => 
                    nsPluginTag* tag = nsnull;
                    rv = LoadXPCOMPlugin(registry, nsnull, key, &tag);
                    if (NS_FAILED(rv))
            nsPluginHostImpl::LoadPlugins(void) [nsPluginHostImpl.cpp:4635]
                  }
                
                  // Load cached plugins info
             =>   LoadCachedPluginsInfo(registry);
                
                  // retrieve a path for layout module. Needed for plugin mime 
types registration
                  nsCOMPtr<nsIFile> layoutPath;
            nsPluginHostImpl::GetPluginFactory(char const*,nsIPlugin * *) 
[nsPluginHostImpl.cpp:4275]
                  CleanUnusedLibraries();
                
                  // If plugins haven't been scanned yet, do so now
             =>   LoadPlugins();
                
                  nsPluginTag* pluginTag;
                  if((rv = FindPluginEnabledForType(aMimeType, pluginTag)) == 
NS_OK)
            nsJVMManager::StartupJVM(void) [nsJVMManager.cpp:665]
            nsJVMManager::MaybeStartupLiveConnect(void) [nsJVMManager.cpp:901]
another stack in the same code...

    [W] MLK: Memory leak of 508 bytes from 19 blocks allocated in PL_strdup
        Distribution of leaked blocks
        Allocation location
        malloc         [dbgheap.c:129]
        PL_strdup      [strdup.c:46]
        nsCRT::strdup(char const*) [nsCRT.h:182]
        nsRegistry::GetBytesUTF8(UINT,char const*,UINT *,BYTE * *) 
[nsRegistry.cpp:859]
                    if ( err == REGERR_OK )
                    {
                        *length = length2;
     =>                 *result = (PRUint8*)(nsCRT::strdup(regStr));
                        if (!*result)
                        {
                            rv = NS_ERROR_OUT_OF_MEMORY;
        LoadXPCOMPlugin [nsPluginHostImpl.cpp:4786]
          // in the registry. Pull these out now.
          PRUint8 * name;
          PRUint32 length;
     =>   aRegistry->GetBytesUTF8(aPluginKey, kPluginsNameKey, &length, &name);
                    
                      PRUint8 * description;
                      aRegistry->GetBytesUTF8(aPluginKey, kPluginsDescKey, 
&length, &description);
                nsPluginHostImpl::LoadCachedPluginsInfo(nsIRegistry *) 
[nsPluginHostImpl.cpp:5107]
                        node->GetKey(&key);
                    
                        nsPluginTag* tag = nsnull;
                 =>     rv = LoadXPCOMPlugin(registry, nsnull, key, &tag);
                        if (NS_FAILED(rv))
                          continue;
                    
                nsPluginHostImpl::LoadPlugins(void) [nsPluginHostImpl.cpp:4635]
                      }
                    
                      // Load cached plugins info
                 =>   LoadCachedPluginsInfo(registry);
                    
                      // retrieve a path for layout module. Needed for plugin 
mime types registration
                      nsCOMPtr<nsIFile> layoutPath;
                nsPluginHostImpl::GetPluginFactory(char const*,nsIPlugin * *) 
[nsPluginHostImpl.cpp:4275]
                      CleanUnusedLibraries();
                    
                      // If plugins haven't been scanned yet, do so now
                 =>   LoadPlugins();
                    
                      nsPluginTag* pluginTag;
                      if((rv = FindPluginEnabledForType(aMimeType, pluginTag)) 
== NS_OK)
                nsJVMManager::StartupJVM(void) [nsJVMManager.cpp:665]
                        nsCOMPtr<nsIPlugin> f =
                                 
do_GetService(NS_INLINE_PLUGIN_CONTRACTID_PREFIX NS_JVM_MIME_TYPE, &err);
                        if (NS_FAILED(err) || !f) {
                 =>         err = pluginHost->GetPluginFactory(NS_JVM_MIME_TYPE, 
&pluginFactory);
                        }
                        else {
                            pluginFactory  = f;
                nsJVMManager::MaybeStartupLiveConnect(void) 
[nsJVMManager.cpp:901]
I have a fix in my tree, will attach it. 
Keywords: mlk
Attached patch proposed fixSplinter Review
The fix is to free name and description.
cc peterl, av for review
cc beard for review
Comment on attachment 62569 [details] [diff] [review]
proposed fix

Good catch. r=av.
Attachment #62569 - Flags: review+
Comment on attachment 62569 [details] [diff] [review]
proposed fix

sr=mscott
Attachment #62569 - Flags: superreview+
fixed
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: