summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 04:16:22 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-04 04:16:22 +0000
commitdd1e41a83fc1e11227caffcde580122588c203d2 (patch)
tree76fd44337d916dcf28416c74bdf36578db623f1a /chrome/browser
parente2eac863ff01de3913e04ec1a5a97be0dbcfc730 (diff)
downloadchromium_src-dd1e41a83fc1e11227caffcde580122588c203d2.zip
chromium_src-dd1e41a83fc1e11227caffcde580122588c203d2.tar.gz
chromium_src-dd1e41a83fc1e11227caffcde580122588c203d2.tar.bz2
Fix leak reported in extensions_quota_service_unittest.cc
TBR=nick Review URL: http://codereview.chromium.org/468018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33791 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/extensions/extensions_quota_service.h3
-rw-r--r--chrome/browser/extensions/extensions_quota_service_unittest.cc9
2 files changed, 5 insertions, 7 deletions
diff --git a/chrome/browser/extensions/extensions_quota_service.h b/chrome/browser/extensions/extensions_quota_service.h
index f68a763..700f9cc 100644
--- a/chrome/browser/extensions/extensions_quota_service.h
+++ b/chrome/browser/extensions/extensions_quota_service.h
@@ -99,7 +99,7 @@ class QuotaLimitHeuristic {
// come in). So, a bucket has an expiration to denote it has becomes stale.
class Bucket {
public:
- explicit Bucket() : num_tokens_(0) {}
+ Bucket() : num_tokens_(0) {}
// Removes a token from this bucket, and returns true if the bucket had
// any tokens in the first place.
bool DeductToken() { return num_tokens_-- > 0; }
@@ -130,6 +130,7 @@ class QuotaLimitHeuristic {
// for this QuotaLimitHeuristic.
class BucketMapper {
public:
+ virtual ~BucketMapper() {}
// In most cases, this should simply extract item IDs from the arguments
// (e.g for bookmark operations involving an existing item). If a problem
// occurs while parsing |args|, the function aborts - buckets may be non-
diff --git a/chrome/browser/extensions/extensions_quota_service_unittest.cc b/chrome/browser/extensions/extensions_quota_service_unittest.cc
index fae8d41..80457eb 100644
--- a/chrome/browser/extensions/extensions_quota_service_unittest.cc
+++ b/chrome/browser/extensions/extensions_quota_service_unittest.cc
@@ -34,12 +34,9 @@ class Mapper : public QuotaLimitHeuristic::BucketMapper {
for (size_t i = 0; i < v->GetSize(); i++) {
int id;
ASSERT_TRUE(v->GetInteger(i, &id));
- Bucket* bucket = buckets_[id];
- if (bucket == NULL) {
- bucket = new Bucket();
- buckets_[id] = bucket;
- }
- buckets->push_back(bucket);
+ if (buckets_.find(id) == buckets_.end())
+ buckets_[id] = new Bucket();
+ buckets->push_back(buckets_[id]);
}
}
private: