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

Unified Diff: chrome/browser/sync_file_system/drive_backend/metadata_database.cc

Issue 22782002: [SyncFS] Fix leak on MetadataDatabase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leak fix Created 7 years, 4 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/sync_file_system/drive_backend/metadata_database.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
index 409f70a6f4126b749c5fc79c9f8d4aae21a3b4da..a7e08bc038f8ea42a25f62241ab5ee8589dc2d12 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database.cc
@@ -641,7 +641,10 @@ void MetadataDatabase::UpdateByChangeList(
if (FindTrackersByFileID(file_id, NULL)) {
PutFileToBatch(*file, batch.get());
- file_by_id_[file_id] = file.release();
+
+ FileMetadata* file_ptr = file.release();
+ std::swap(file_ptr, file_by_id_[file_id]);
+ delete file_ptr;
}
}
« 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