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

Unified Diff: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc

Issue 10970026: Fix drive-by memory leak in media_galleries_api.cc. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 2f4edc6014fce183eead92e9fdb3df45025d949b..a1b2627b952c8e9d3759017754854c7a1d8443bb 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -114,7 +114,8 @@ void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries(
std::set<std::string> file_system_names;
base::ListValue* list = new base::ListValue();
for (size_t i = 0; i < filesystems.size(); i++) {
- base::DictionaryValue* file_system_dict_value = new base::DictionaryValue();
+ scoped_ptr<base::DictionaryValue> file_system_dict_value(
+ new base::DictionaryValue());
// Send the file system id so the renderer can create a valid FileSystem
// object.
@@ -130,7 +131,7 @@ void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries(
file_system_dict_value->SetWithoutPathExpansion(
"name", Value::CreateStringValue(filesystems[i].name));
- list->Append(file_system_dict_value);
+ list->Append(file_system_dict_value.release());
if (!filesystems[i].path.empty() &&
MediaGalleriesPermission::HasReadAccess(*GetExtension())) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698