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

Issue 10735040: gdata: Fix a leak from GDataEntry::FromProtoString() (Closed)

Created:
8 years, 5 months ago by satorux1
Modified:
8 years, 5 months ago
Reviewers:
achuithb
CC:
chromium-reviews, achuith+watch_chromium.org, oshima+watch_chromium.org, stevenjb+watch_chromium.org, nkostylev+watch_chromium.org, davemoore+watch_chromium.org
Visibility:
Public.

Description

gdata: Fix a leak from GDataEntry::FromProtoString() The leakage ocurrred on failure. BUG=136597 TEST=tools/valgrind/valgrind.sh --leak-check=full out/Release/unit_tests --gtest_filter=GDataDBTest.* Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=146058

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+4 lines, -4 lines) Patch
M chrome/browser/chromeos/gdata/gdata_files.cc View 1 chunk +4 lines, -4 lines 4 comments Download

Messages

Total messages: 4 (0 generated)
satorux1
8 years, 5 months ago (2012-07-10 22:54:55 UTC) #1
achuithb
http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/gdata_files.cc File chrome/browser/chromeos/gdata/gdata_files.cc (right): http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/gdata_files.cc#newcode740 chrome/browser/chromeos/gdata/gdata_files.cc:740: return scoped_ptr<GDataEntry>(dir.release()); I think you can return dir.Pass() in ...
8 years, 5 months ago (2012-07-10 23:09:02 UTC) #2
satorux1
http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/gdata_files.cc File chrome/browser/chromeos/gdata/gdata_files.cc (right): http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/gdata_files.cc#newcode740 chrome/browser/chromeos/gdata/gdata_files.cc:740: return scoped_ptr<GDataEntry>(dir.release()); On 2012/07/10 23:09:02, achuith.bhandarkar wrote: > I ...
8 years, 5 months ago (2012-07-10 23:25:03 UTC) #3
achuithb
8 years, 5 months ago (2012-07-10 23:29:15 UTC) #4
lgtm

http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/...
File chrome/browser/chromeos/gdata/gdata_files.cc (right):

http://codereview.chromium.org/10735040/diff/1/chrome/browser/chromeos/gdata/...
chrome/browser/chromeos/gdata/gdata_files.cc:740: return
scoped_ptr<GDataEntry>(dir.release());
On 2012/07/10 23:25:04, satorux1 wrote:
> On 2012/07/10 23:09:02, achuith.bhandarkar wrote:
> > I think you can return dir.Pass() in both cases, ie, don't need the if stmt?
> 
> If FromProto() failed, we should return NULL.
> 
> Note that dir.Pass() doesn't work as dir is scoped_ptr<GDataDirectory> but we
> should return scoped_ptr<GDataEntry>

Ah, that's unfortunate. I believe there's a way to cast scoped_ptr but not worth
it.

Powered by Google App Engine
This is Rietveld 408576698