diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:31:10 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:31:10 +0000 |
commit | 655051daaef6ec771e01887c4e0c7a1ad7f5702a (patch) | |
tree | 32b6b9b706a6f938843b93a74e0e2fa138e37a84 /chrome/browser/webdata | |
parent | 2e2fd4367015f931199102f764c9e0942f7ef0c3 (diff) | |
download | chromium_src-655051daaef6ec771e01887c4e0c7a1ad7f5702a.zip chromium_src-655051daaef6ec771e01887c4e0c7a1ad7f5702a.tar.gz chromium_src-655051daaef6ec771e01887c4e0c7a1ad7f5702a.tar.bz2 |
Fix AutoFillProfile leaks in WebDataService.
TBR=akalin
Review URL: http://codereview.chromium.org/1569016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata')
-rw-r--r-- | chrome/browser/webdata/web_data_service.cc | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc index 1874564..f0ba6fa 100644 --- a/chrome/browser/webdata/web_data_service.cc +++ b/chrome/browser/webdata/web_data_service.cc @@ -806,10 +806,11 @@ void WebDataService::UpdateAutoFillProfileImpl( // The AUTOFILL_PROFILE_CHANGED contract for an update requires that we // send along the label of the un-updated profile, to detect label // changes separately. So first, we query for the existing profile. - AutoFillProfile* old_profile = NULL; - if (!db_->GetAutoFillProfileForID(profile.unique_id(), &old_profile)) + AutoFillProfile* old_profile_ptr = NULL; + if (!db_->GetAutoFillProfileForID(profile.unique_id(), &old_profile_ptr)) NOTREACHED(); - if (old_profile) { + if (old_profile_ptr) { + scoped_ptr<AutoFillProfile> old_profile(old_profile_ptr); if (!db_->UpdateAutoFillProfile(profile)) NOTREACHED(); ScheduleCommit(); @@ -831,11 +832,12 @@ void WebDataService::RemoveAutoFillProfileImpl( InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { int profile_id = request->GetArgument(); - AutoFillProfile* dead_profile = NULL; - if (!db_->GetAutoFillProfileForID(profile_id, &dead_profile)) + AutoFillProfile* profile = NULL; + if (!db_->GetAutoFillProfileForID(profile_id, &profile)) NOTREACHED(); - if (dead_profile) { + if (profile) { + scoped_ptr<AutoFillProfile> dead_profile(profile); if (!db_->RemoveAutoFillProfile(profile_id)) NOTREACHED(); ScheduleCommit(); @@ -907,14 +909,17 @@ void WebDataService::RemoveCreditCardImpl( InitializeDatabaseIfNecessary(); if (db_ && !request->IsCancelled()) { int creditcard_id = request->GetArgument(); - CreditCard* dead_card = NULL; - if (!db_->GetCreditCardForID(creditcard_id, &dead_card)) + CreditCard* dead_card_ptr = NULL; + if (!db_->GetCreditCardForID(creditcard_id, &dead_card_ptr)) NOTREACHED(); + + scoped_ptr<CreditCard> dead_card(dead_card_ptr); if (!db_->RemoveCreditCard(creditcard_id)) NOTREACHED(); + ScheduleCommit(); - if (dead_card) { + if (dead_card.get()) { AutofillCreditCardChange change(AutofillCreditCardChange::REMOVE, dead_card->Label(), NULL); NotificationService::current()->Notify( |