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

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: include scoped_ptr 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..648c9d61bc70b66657ad1beab0e8be5b5cd7f421 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/memory/scoped_ptr.h"
#include "base/platform_file.h"
#include "base/stl_util.h"
#include "base/values.h"
@@ -114,7 +115,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 +132,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