summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 23:24:04 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 23:24:04 +0000
commitb6eea42d4bb35b0002d31b17e7bd5f51b7075521 (patch)
treefe780049908a62c6b4ba3e59aae9f25de79cf22f /net
parent6e79bdd62a59c64cb1590b60c01be72a8860fb66 (diff)
downloadchromium_src-b6eea42d4bb35b0002d31b17e7bd5f51b7075521.zip
chromium_src-b6eea42d4bb35b0002d31b17e7bd5f51b7075521.tar.gz
chromium_src-b6eea42d4bb35b0002d31b17e7bd5f51b7075521.tar.bz2
Fix memory leak when simulating failures in unit tests.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 7810a97..cf8237e 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -1040,7 +1040,9 @@ void BackendImpl::RestartCache() {
// Don't call Init() if directed by the unit test: we are simulating a failure
// trying to re-enable the cache.
- if (!unit_test_ && Init())
+ if (unit_test_)
+ init_ = true; // Let the destructor do proper cleanup.
+ else if (Init())
stats_.SetCounter(Stats::FATAL_ERROR, errors + 1);
}