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

Issue 7831056: Fix a memory leak in a unit test. (Closed)

Created:
9 years, 3 months ago by erikwright (departed)
Modified:
9 years, 3 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, erikwright (departed), Paweł Hajdan Jr., wtc, Randy Smith (Not in Mondays), darin-cc_chromium.org, rkn
Visibility:
Public.

Description

Fix a memory leak in a unit test. In the DeferredDeleteCanonicalCookie test, we were using an existing helper method that initialized a CanonicalCookie on the heap and put a pointer to it in a list. This makes sense for other tests because they provide that list to the CookieMonster, which takes ownership of the list. In this case, we only needed one cookie, which we pass by reference to the CookieMonster via a method that does not take ownership. Yet, it's enough of a hassle to create the cookie that I used this method. The result is that no-one deletes the cookie from the heap. I extracted the existing code that prepared the cookie, so that one can create either a single cookie or a list of them. BUG=68657 TEST=net_unittests / DeferredDeleteCanonicalCookie Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=100316

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -12 lines) Patch
M net/base/cookie_monster_store_test.h View 1 chunk +6 lines, -0 lines 0 comments Download
M net/base/cookie_monster_store_test.cc View 2 chunks +17 lines, -9 lines 0 comments Download
M net/base/cookie_monster_unittest.cc View 1 chunk +4 lines, -3 lines 0 comments Download

Messages

Total messages: 1 (0 generated)
Randy Smith (Not in Mondays)
9 years, 3 months ago (2011-09-08 20:37:38 UTC) #1
LGTM.

Powered by Google App Engine
This is Rietveld 408576698