Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2274)

Unified Diff: chrome/browser/content_settings/host_content_settings_map.cc

Issue 8528031: Fix memory leak in SetDefaultContentSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove Valgrind suppressions. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/content_settings/host_content_settings_map.cc
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc
index 39c38a939349651c70d02e0a1759414851fc117a..37045489edb3856fee86e2a59ce809f859b2ddea 100644
--- a/chrome/browser/content_settings/host_content_settings_map.cc
+++ b/chrome/browser/content_settings/host_content_settings_map.cc
@@ -210,12 +210,15 @@ void HostContentSettingsMap::SetDefaultContentSetting(
DCHECK_NE(content_type, CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE);
DCHECK(IsSettingAllowedForType(setting, content_type));
- base::Value* value = Value::CreateIntegerValue(setting);
- if (!content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting(
- ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
- content_type, std::string(), value)) {
- delete value;
- }
+ base::Value* value = NULL;
+ if (setting != CONTENT_SETTING_DEFAULT)
+ value = Value::CreateIntegerValue(setting);
+ SetWebsiteSetting(
+ ContentSettingsPattern::Wildcard(),
+ ContentSettingsPattern::Wildcard(),
+ content_type,
+ std::string(),
+ value);
}
void HostContentSettingsMap::SetWebsiteSetting(
« no previous file with comments | « chrome/browser/content_settings/content_settings_default_provider.cc ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698