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

Unified Diff: chrome/browser/chromeos/gdata/gdata_files.cc

Issue 10735040: gdata: Fix a leak from GDataEntry::FromProtoString() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/chromeos/gdata/gdata_files.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc
index efe657cccce69da6faed8da9201f66bb60581d7c..e188d11af343ff25989391b8857fe6840f68d8ae 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.cc
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc
@@ -734,20 +734,20 @@ scoped_ptr<GDataEntry> GDataEntry::FromProtoString(
GDataDirectoryProto dir_proto;
bool ok = dir_proto.ParseFromString(serialized_proto);
if (ok && dir_proto.gdata_entry().file_info().is_directory()) {
- GDataDirectory* dir = new GDataDirectory(NULL, NULL);
+ scoped_ptr<GDataDirectory> dir(new GDataDirectory(NULL, NULL));
if (!dir->FromProto(dir_proto))
return scoped_ptr<GDataEntry>(NULL);
- return scoped_ptr<GDataEntry>(dir);
+ return scoped_ptr<GDataEntry>(dir.release());
achuithb 2012/07/10 23:09:02 I think you can return dir.Pass() in both cases, i
satorux1 2012/07/10 23:25:04 If FromProto() failed, we should return NULL. Not
achuithb 2012/07/10 23:29:15 Ah, that's unfortunate. I believe there's a way to
}
GDataFileProto file_proto;
ok = file_proto.ParseFromString(serialized_proto);
if (ok) {
DCHECK(!file_proto.gdata_entry().file_info().is_directory());
- GDataFile* file = new GDataFile(NULL, NULL);
+ scoped_ptr<GDataFile> file(new GDataFile(NULL, NULL));
if (!file->FromProto(file_proto))
return scoped_ptr<GDataEntry>(NULL);
- return scoped_ptr<GDataEntry>(file);
+ return scoped_ptr<GDataEntry>(file.release());
achuithb 2012/07/10 23:09:02 same
}
return scoped_ptr<GDataEntry>(NULL);
}
« 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