summaryrefslogtreecommitdiffstats
path: root/sync/syncable/directory.cc
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 22:47:20 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-15 22:47:20 +0000
commit5a05b1de6bb31e66f570b320b6b507e0e2d5798b (patch)
tree23b917abaac13ec29bc29dc17179dc4f136e0903 /sync/syncable/directory.cc
parent7b536cbc0794e6daf602b33c59a638cf24f4253e (diff)
downloadchromium_src-5a05b1de6bb31e66f570b320b6b507e0e2d5798b.zip
chromium_src-5a05b1de6bb31e66f570b320b6b507e0e2d5798b.tar.gz
chromium_src-5a05b1de6bb31e66f570b320b6b507e0e2d5798b.tar.bz2
sync: Improve handling of bad UniquePos (retry)
Retry: The first attempt had a memory leak. It seems that this leak existed before this CL, but no code exercised it. This updated CL includes a scoped deleter that should fix it. Original commits message was: Makes the client assign a valid position to incoming bookmarks if the server has not populated the required fields. This code should never be triggered unless there is a bug in the server. This risks reordering users' bookmarks, but that's probably preferable to a crash. This fallback code is still protected by a NOTREACHED(), as before. Detects bookmarks that do not have valid position information during database load. If these corrupted bookmarks are detected, the entire database is declared to be corrupt. Sync will then re-download all of the user's data, which should fix the problem. BUG=367247 Review URL: https://codereview.chromium.org/283143002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/syncable/directory.cc')
-rw-r--r--sync/syncable/directory.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sync/syncable/directory.cc b/sync/syncable/directory.cc
index cebb2d4..e523bcd 100644
--- a/sync/syncable/directory.cc
+++ b/sync/syncable/directory.cc
@@ -167,6 +167,11 @@ DirOpenResult Directory::OpenImpl(
// Temporary indices before kernel_ initialized in case Load fails. We 0(1)
// swap these later.
Directory::MetahandlesMap tmp_handles_map;
+
+ // Avoids mem leaks on failure. Harmlessly deletes the empty hash map after
+ // the swap in the success case.
+ STLValueDeleter<Directory::MetahandlesMap> deleter(&tmp_handles_map);
+
JournalIndex delete_journals;
DirOpenResult result =