summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 20:51:36 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 20:51:36 +0000
commit9bcdced7fe51e35fe578d925403ec2dfbd7a0b26 (patch)
treec349cf0a8e71f1a0768056048fdbac3727adfeab /webkit/glue/plugins
parent4bf0e93c4ccf7e0b0273517e35fafca5193435fd (diff)
downloadchromium_src-9bcdced7fe51e35fe578d925403ec2dfbd7a0b26.zip
chromium_src-9bcdced7fe51e35fe578d925403ec2dfbd7a0b26.tar.gz
chromium_src-9bcdced7fe51e35fe578d925403ec2dfbd7a0b26.tar.bz2
Valgrind: Fix leak in plugin group code.
BUG=none TEST=Memory tree goes green. Review URL: http://codereview.chromium.org/5529007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r--webkit/glue/plugins/plugin_list.cc27
1 files changed, 20 insertions, 7 deletions
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index 5dcda7e..07dfcdd 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
+#include "base/stl_util-inl.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
@@ -20,6 +21,10 @@
#include "webkit/glue/plugins/plugin_switches.h"
#include "webkit/glue/webkit_glue.h"
+#if defined(OS_POSIX)
+#include "base/third_party/valgrind/valgrind.h"
+#endif // defined(OS_POSIX)
+
namespace NPAPI {
#if defined(OS_MACOSX)
@@ -294,7 +299,7 @@ void PluginList::LoadPlugins(bool refresh) {
LoadPluginsFromDir(directories_to_scan[i], &new_plugins, &visited_plugins);
}
-#if defined OS_WIN
+#if defined(OS_WIN)
LoadPluginsFromRegistry(&new_plugins, &visited_plugins);
#endif
@@ -431,12 +436,12 @@ void PluginList::GetEnabledPlugins(bool refresh,
}
}
-void PluginList::GetPluginInfoArray(const GURL& url,
- const std::string& mime_type,
- bool allow_wildcard,
- std::vector<WebPluginInfo>* info,
- std::vector<std::string>* actual_mime_types)
-{
+void PluginList::GetPluginInfoArray(
+ const GURL& url,
+ const std::string& mime_type,
+ bool allow_wildcard,
+ std::vector<WebPluginInfo>* info,
+ std::vector<std::string>* actual_mime_types) {
DCHECK(mime_type == StringToLowerASCII(mime_type));
DCHECK(info);
@@ -715,6 +720,14 @@ void PluginList::Shutdown() {
// Note: plugin_groups_ contains simple pointers of type PluginGroup*, but
// since this singleton lives until the process is destroyed, no explicit
// cleanup is necessary.
+ // However, when running on Valgrind, we need to do the cleanup to keep the
+ // memory tree green.
+#if defined(OS_POSIX)
+ if (RUNNING_ON_VALGRIND) {
+ STLDeleteContainerPairSecondPointers(plugin_groups_.begin(),
+ plugin_groups_.end());
+ }
+#endif
}
} // namespace NPAPI