summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 20:56:49 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-08 20:56:49 +0000
commit378c3fdf56d3f6328632f0e994a678c9387c78d3 (patch)
tree344afadf27316d241d81129085482c9065ed8097 /chrome/browser/history
parentd1bad238a93b0b3c50bafdc566431d2072f33d44 (diff)
downloadchromium_src-378c3fdf56d3f6328632f0e994a678c9387c78d3.zip
chromium_src-378c3fdf56d3f6328632f0e994a678c9387c78d3.tar.gz
chromium_src-378c3fdf56d3f6328632f0e994a678c9387c78d3.tar.bz2
Coverity: fix possible leak in VisitSegmentDatabase.
If we get a non-zero segment_id, a zero segment_id, and another non-zero segment_id, the pud for the zero segment_id will be leaked. A non-zero segment_id shouldn't happen since it refers to a primary-key in the segments table, but this changes it to check directly whether a pud has been created, and thus makes it more error-proof. This should be safe, as pud is only stored into the list in two places, in the first it is immediately replaced with a new pud, in the second it is storing the final pud (if any.) CID=6379 TEST=none BUG=none Review URL: http://codereview.chromium.org/265027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/visitsegment_database.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/chrome/browser/history/visitsegment_database.cc b/chrome/browser/history/visitsegment_database.cc
index b18712b..27e0387 100644
--- a/chrome/browser/history/visitsegment_database.cc
+++ b/chrome/browser/history/visitsegment_database.cc
@@ -253,7 +253,7 @@ void VisitSegmentDatabase::QuerySegmentUsage(
while (statement.Step()) {
SegmentID segment_id = statement.ColumnInt64(0);
if (segment_id != last_segment_id) {
- if (last_segment_id != 0) {
+ if (pud) {
pud->SetScore(score);
results->push_back(pud);
}
@@ -279,7 +279,7 @@ void VisitSegmentDatabase::QuerySegmentUsage(
score += recency_boost * day_visits_score;
}
- if (last_segment_id != 0) {
+ if (pud) {
pud->SetScore(score);
results->push_back(pud);
}