From b6eea42d4bb35b0002d31b17e7bd5f51b7075521 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Wed, 30 Jul 2008 23:24:04 +0000 Subject: 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 --- net/disk_cache/backend_impl.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net') 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); } -- cgit v1.1