diff options
author | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 13:56:38 +0000 |
---|---|---|
committer | markusheintz@chromium.org <markusheintz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-18 13:56:38 +0000 |
commit | e36eaacd4f118c6c6f9e093c787a151dcccf82dc (patch) | |
tree | 9627f1ede329c9c1e163e163a889ebb5e4e4dd6a /base/values.cc | |
parent | f0e88d3f4d2b2e022f35c9d47b164124054443ed (diff) | |
download | chromium_src-e36eaacd4f118c6c6f9e093c787a151dcccf82dc.zip chromium_src-e36eaacd4f118c6c6f9e093c787a151dcccf82dc.tar.gz chromium_src-e36eaacd4f118c6c6f9e093c787a151dcccf82dc.tar.bz2 |
Let the method ListValue::AppendIfNotPresent always take ownership of the |in_value|. In any cases. What is passed in get's owned.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6695019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78686 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/values.cc')
-rw-r--r-- | base/values.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/base/values.cc b/base/values.cc index 9c96f26..9f2816a 100644 --- a/base/values.cc +++ b/base/values.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -840,8 +840,10 @@ void ListValue::Append(Value* in_value) { bool ListValue::AppendIfNotPresent(Value* in_value) { DCHECK(in_value); for (ValueVector::const_iterator i(list_.begin()); i != list_.end(); ++i) { - if ((*i)->Equals(in_value)) + if ((*i)->Equals(in_value)) { + delete in_value; return false; + } } list_.push_back(in_value); return true; |