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

Unified Diff: chrome/browser/extensions/syncable_extension_settings_storage.cc

Issue 7978053: Fix memory leak in SyncableExtensionSettingsStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 months 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
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/syncable_extension_settings_storage.cc
diff --git a/chrome/browser/extensions/syncable_extension_settings_storage.cc b/chrome/browser/extensions/syncable_extension_settings_storage.cc
index 137a6cb223783a420d1ce5589eaf57c25609f123..a3f3e14e24f54463c9b9a1455706878a17b2f47a 100644
--- a/chrome/browser/extensions/syncable_extension_settings_storage.cc
+++ b/chrome/browser/extensions/syncable_extension_settings_storage.cc
@@ -176,15 +176,19 @@ SyncError SyncableExtensionSettingsStorage::OverwriteLocalSettingsWithSync(
ExtensionSettingSyncDataList changes;
for (DictionaryValue::key_iterator it = settings.begin_keys();
it != settings.end_keys(); ++it) {
- Value* sync_value = NULL;
- if (new_sync_state->RemoveWithoutPathExpansion(*it, &sync_value)) {
+ Value* orphaned_sync_value = NULL;
+ if (new_sync_state->RemoveWithoutPathExpansion(*it, &orphaned_sync_value)) {
+ scoped_ptr<Value> sync_value(orphaned_sync_value);
Value* local_value = NULL;
settings.GetWithoutPathExpansion(*it, &local_value);
- if (!local_value->Equals(sync_value)) {
+ if (!sync_value->Equals(local_value)) {
// Sync value is different, update local setting with new value.
changes.push_back(
ExtensionSettingSyncData(
- SyncChange::ACTION_UPDATE, extension_id_, *it, sync_value));
+ SyncChange::ACTION_UPDATE,
+ extension_id_,
+ *it,
+ sync_value.release()));
}
} else {
// Not synced, delete local setting.
@@ -200,8 +204,8 @@ SyncError SyncableExtensionSettingsStorage::OverwriteLocalSettingsWithSync(
// Add all new settings to local settings.
while (!new_sync_state->empty()) {
std::string key = *new_sync_state->begin_keys();
- Value* value;
- new_sync_state->RemoveWithoutPathExpansion(key, &value);
+ Value* value = NULL;
+ CHECK(new_sync_state->RemoveWithoutPathExpansion(key, &value));
changes.push_back(
ExtensionSettingSyncData(
SyncChange::ACTION_ADD, extension_id_, key, value));
« no previous file with comments | « no previous file | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698