Bug 478823: Fix memory leak that can result from reloading the plugin list. r=josh r=jst a=blocking2.0b8+

This commit is contained in:
Scott Greenlay 2010-10-13 11:50:35 -04:00
parent df81141dd1
commit bfc806a99a

View File

@ -2030,19 +2030,15 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir,
*aPluginsChanged = PR_TRUE;
}
}
}
else {
// plugin file was added, flag this fact
*aPluginsChanged = PR_TRUE;
}
// if we are not creating the list, just continue the loop
// no need to proceed if changes are detected
if (!aCreatePluginList) {
if (*aPluginsChanged)
return NS_OK;
else
// If we're not creating a list and we already know something changed then
// we're done.
if (!aCreatePluginList) {
if (*aPluginsChanged) {
return NS_OK;
}
continue;
}
}
// if it is not found in cache info list or has been changed, create a new one
@ -2130,6 +2126,15 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir,
// do it if we still want it
if (bAddIt) {
// We have a valid new plugin so report that plugins have changed.
*aPluginsChanged = PR_TRUE;
// If we're not creating a plugin list, simply looking for changes,
// then we're done.
if (!aCreatePluginList) {
return NS_OK;
}
pluginTag->SetHost(this);
pluginTag->mNext = mPlugins;
mPlugins = pluginTag;