Commit 5b92bc6a authored by akalin@chromium.org's avatar akalin@chromium.org

Fix memory leak in SyncableExtensionSettingsStorage.

Original patch by kalman@chromium.org

BUG=97511
TEST=
TBR=kalman@chromium.org

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102246 0039d316-1c4b-4281-b951-d872f2087c98
parent 746ba221
......@@ -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));
......
......@@ -1687,9 +1687,3 @@
fun:sync_notifier::NonBlockingInvalidationNotifier::Core::UpdateCredentials
fun:void DispatchToMethod
}
{
bug_97511_b
Heapcheck:Leak
...
fun:ExtensionSettingsSyncTest*
}
......@@ -4622,17 +4622,6 @@
fun:vorbis_decode_frame
fun:avcodec_decode_audio3
}
{
bug_97511_d
Memcheck:Leak
fun:_Znw*
...
fun:_ZNK4base15DictionaryValue8DeepCopyEv
fun:_ZN32SyncableExtensionSettingsStorage30OverwriteLocalSettingsWithSyncERKN4base15DictionaryValueES3_
fun:_ZN32SyncableExtensionSettingsStorage12StartSyncingERKN4base15DictionaryValueEP19SyncChangeProcessor
fun:_ZN17ExtensionSettings24MergeDataAndStartSyncingEN8syncable9ModelTypeERKSt6vectorI8SyncDataSaIS3_EEP19SyncChangeProcessor
fun:_ZN58ExtensionSettingsSyncTest_InSyncDataDoesNotInvokeSync_Test8TestBodyEv
}
#-----------------------------------------------------------------------
# 4. These only occur on our Google workstations
......
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