Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3067)

Unified Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 454083002: Fix a memory leak in PasswordStoreMac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_store_mac_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/password_manager/password_store_mac.cc
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 5fad2ae20e1fbb20bbd5770af9e9a52b7d41ee8d..3abc45ff7c8b1377d3458ec4ac4fdbec5d755709 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -618,19 +618,19 @@ std::vector<PasswordForm*> MacKeychainPasswordFormAdapter::PasswordsFillingForm(
return ConvertKeychainItemsToForms(&keychain_items);
}
-PasswordForm* MacKeychainPasswordFormAdapter::PasswordExactlyMatchingForm(
- const PasswordForm& query_form) {
+scoped_ptr<PasswordForm> MacKeychainPasswordFormAdapter::
+ PasswordExactlyMatchingForm(const PasswordForm& query_form) {
SecKeychainItemRef keychain_item = KeychainItemForForm(query_form);
if (keychain_item) {
- PasswordForm* form = new PasswordForm();
+ scoped_ptr<PasswordForm> form(new PasswordForm);
internal_keychain_helpers::FillPasswordFormFromKeychainItem(*keychain_,
keychain_item,
- form,
+ form.get(),
true);
keychain_->Free(keychain_item);
- return form;
+ return form.Pass();
}
- return NULL;
+ return scoped_ptr<PasswordForm>();
}
bool MacKeychainPasswordFormAdapter::HasPasswordsMergeableWithForm(
@@ -942,9 +942,7 @@ PasswordStoreChangeList PasswordStoreMac::RemoveLoginImpl(
// handle deletes on them the way we would for an imported item.)
MacKeychainPasswordFormAdapter owned_keychain_adapter(keychain_.get());
owned_keychain_adapter.SetFindsOnlyOwnedItems(true);
- PasswordForm* owned_password_form =
- owned_keychain_adapter.PasswordExactlyMatchingForm(form);
- if (owned_password_form) {
+ if (owned_keychain_adapter.PasswordExactlyMatchingForm(form)) {
Ilya Sherman 2014/08/12 00:31:51 Hmm, could the method be changed to instead just r
vasilii 2014/08/12 09:17:37 The returned value is used in unit tests. With boo
Ilya Sherman 2014/08/12 17:21:25 Hmm, why do the tests need more information that t
vasilii 2014/08/13 09:56:46 Done.
// If we don't have other forms using it (i.e., a form differing only by
// the names of the form elements), delete the keychain entry.
if (!DatabaseHasFormMatchingKeychainForm(form)) {
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_store_mac_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698