Commit c2632ab1 authored by jhawkins@chromium.org's avatar jhawkins@chromium.org

Valgrind: Fix a leak in ContentSettingsProvider.

If the call to SetWebsiteSetting() fails, the value is still owned by the
caller and must be deleted.

BUG=none
TEST=none

R=bauerb@chromium.org

Review URL: http://codereview.chromium.org/8592001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110594 0039d316-1c4b-4281-b951-d872f2087c98
parent 7b580671
...@@ -42,7 +42,7 @@ class ProviderInterface { ...@@ -42,7 +42,7 @@ class ProviderInterface {
const ResourceIdentifier& resource_identifier, const ResourceIdentifier& resource_identifier,
bool incognito) const = 0; bool incognito) const = 0;
// Askes the provider to set the website setting for a particular // Asks the provider to set the website setting for a particular
// |primary_pattern|, |secondary_pattern|, |content_type| tuple. If the // |primary_pattern|, |secondary_pattern|, |content_type| tuple. If the
// provider accepts the setting it returns true and takes the ownership of the // provider accepts the setting it returns true and takes the ownership of the
// |value|. Otherwise false is returned and the ownership of the |value| stays // |value|. Otherwise false is returned and the ownership of the |value| stays
......
...@@ -211,12 +211,11 @@ void HostContentSettingsMap::SetDefaultContentSetting( ...@@ -211,12 +211,11 @@ void HostContentSettingsMap::SetDefaultContentSetting(
DCHECK(IsSettingAllowedForType(setting, content_type)); DCHECK(IsSettingAllowedForType(setting, content_type));
base::Value* value = Value::CreateIntegerValue(setting); base::Value* value = Value::CreateIntegerValue(setting);
content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting( if (!content_settings_providers_[DEFAULT_PROVIDER]->SetWebsiteSetting(
ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(),
ContentSettingsPattern::Wildcard(), content_type, std::string(), value)) {
content_type, delete value;
std::string(), }
value);
} }
void HostContentSettingsMap::SetWebsiteSetting( void HostContentSettingsMap::SetWebsiteSetting(
......
...@@ -246,7 +246,7 @@ TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) { ...@@ -246,7 +246,7 @@ TEST_F(ExtensionSpecialStoragePolicyTest, HasSessionOnlyOrigins) {
EXPECT_TRUE(policy->HasSessionOnlyOrigins()); EXPECT_TRUE(policy->HasSessionOnlyOrigins());
// Clearing an origin-spesific rule. // Clearing an origin-specific rule.
cookie_settings->ResetCookieSetting(pattern, cookie_settings->ResetCookieSetting(pattern,
ContentSettingsPattern::Wildcard()); ContentSettingsPattern::Wildcard());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment