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

Unified Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 2868070: Fix memory leak in chrome/browser/chromeos/input_method/input_method_util.cc. (Closed)
Patch Set: Created 10 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/input_method/input_method_util.cc
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index c5a5c4632017a03f4ed76354a0a5211d0cc13165..01fa576c77b18a14274c840edb9c12b960be0110 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -29,9 +29,9 @@ namespace {
// Map from language code to associated input method IDs, etc.
typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap;
struct IdMaps {
- LanguageCodeToIdsMap* language_code_to_ids;
- std::map<std::string, std::string>* id_to_language_code;
- std::map<std::string, std::string>* id_to_display_name;
+ scoped_ptr<LanguageCodeToIdsMap> language_code_to_ids;
+ scoped_ptr<std::map<std::string, std::string> > id_to_language_code;
+ scoped_ptr<std::map<std::string, std::string> > id_to_display_name;
private:
IdMaps() : language_code_to_ids(NULL),
@@ -46,9 +46,9 @@ struct IdMaps {
// TODO(yusukes): Handle this error in nicer way.
}
- language_code_to_ids = new LanguageCodeToIdsMap;
- id_to_language_code = new std::map<std::string, std::string>;
- id_to_display_name = new std::map<std::string, std::string>;
+ language_code_to_ids.reset(new LanguageCodeToIdsMap);
+ id_to_language_code.reset(new std::map<std::string, std::string>);
+ id_to_display_name.reset(new std::map<std::string, std::string>);
// Build the id to descriptor map for handling kExtraLanguages later.
typedef std::map<std::string,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698