diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 19:24:42 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-04 19:24:42 +0000 |
commit | d22d873921f2f657b483a01a398ddce3001747a1 (patch) | |
tree | 4190718501c4cae47302ea1a8be8ee7b6f4c41cd /chrome/browser/search_engines | |
parent | 30cf2bf9a44e5f97ddd497113bce74feb6b4b517 (diff) | |
download | chromium_src-d22d873921f2f657b483a01a398ddce3001747a1.zip chromium_src-d22d873921f2f657b483a01a398ddce3001747a1.tar.gz chromium_src-d22d873921f2f657b483a01a398ddce3001747a1.tar.bz2 |
Fix various uses of release() that did not check its value
BUG=42904
TEST=compile, unit tests
Review URL: http://codereview.chromium.org/1730024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r-- | chrome/browser/search_engines/template_url_model.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc index d6a8171..361bfb8 100644 --- a/chrome/browser/search_engines/template_url_model.cc +++ b/chrome/browser/search_engines/template_url_model.cc @@ -732,6 +732,7 @@ void TemplateURLModel::MergeEnginesFromPrepopulateData() { std::set<int> updated_ids; for (size_t i = 0; i < loaded_urls.size(); ++i) { + // We take ownership of |t_url|. scoped_ptr<TemplateURL> t_url(loaded_urls[i]); int t_url_id = t_url->prepopulate_id(); if (!t_url_id || updated_ids.count(t_url_id)) { @@ -745,22 +746,21 @@ void TemplateURLModel::MergeEnginesFromPrepopulateData() { const TemplateURL* existing_url = existing_url_iter->second; if (!existing_url->safe_for_autoreplace()) { // User edited the entry, preserve the keyword and description. - loaded_urls[i]->set_safe_for_autoreplace(false); - loaded_urls[i]->set_keyword(existing_url->keyword()); - loaded_urls[i]->set_autogenerate_keyword( + t_url->set_safe_for_autoreplace(false); + t_url->set_keyword(existing_url->keyword()); + t_url->set_autogenerate_keyword( existing_url->autogenerate_keyword()); - loaded_urls[i]->set_short_name(existing_url->short_name()); + t_url->set_short_name(existing_url->short_name()); } - Replace(existing_url, loaded_urls[i]); + Replace(existing_url, t_url.release()); id_to_turl.erase(existing_url_iter); } else { - Add(loaded_urls[i]); + Add(t_url.release()); } if (i == default_search_index && !default_search_provider_) SetDefaultSearchProvider(loaded_urls[i]); updated_ids.insert(t_url_id); - t_url.release(); } // Remove any prepopulated engines which are no longer in the master list, as |