Index: chrome/browser/extensions/component_loader.cc |
diff --git a/chrome/browser/extensions/component_loader.cc b/chrome/browser/extensions/component_loader.cc |
index 87b48d7c1d3c07414b496928f796e893688bf2fe..61dea2ef3079ca84058a9b7db3ec60483bcd0ee1 100644 |
--- a/chrome/browser/extensions/component_loader.cc |
+++ b/chrome/browser/extensions/component_loader.cc |
@@ -42,6 +42,7 @@ ComponentLoader::ComponentLoader(ExtensionServiceInterface* extension_service, |
} |
ComponentLoader::~ComponentLoader() { |
+ ClearAllRegistered(); |
} |
void ComponentLoader::LoadAll() { |
@@ -65,6 +66,16 @@ DictionaryValue* ComponentLoader::ParseManifest( |
return static_cast<DictionaryValue*>(manifest.release()); |
} |
+void ComponentLoader::ClearAllRegistered() { |
+ for (RegisteredComponentExtensions::iterator it = |
+ component_extensions_.begin(); |
+ it != component_extensions_.end(); ++it) { |
+ delete it->manifest; |
+ } |
+ |
+ component_extensions_.clear(); |
+} |
+ |
const Extension* ComponentLoader::Add( |
int manifest_resource_id, |
const FilePath& root_directory) { |
@@ -135,7 +146,8 @@ void ComponentLoader::Remove(const FilePath& root_directory) { |
if (it == component_extensions_.end()) |
return; |
- const DictionaryValue* manifest = it->manifest; |
+ // The list owns the dictionary, so it must be deleted after removal. |
+ scoped_ptr<const DictionaryValue> manifest(it->manifest); |
// Remove the extension from the list of registered extensions. |
*it = component_extensions_.back(); |