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

Unified Diff: chrome/installer/util/master_preferences.cc

Issue 16270: Change the signature of JSONReader::Read() and related methods to be more (Closed)
Patch Set: fixens Created 12 years 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
Index: chrome/installer/util/master_preferences.cc
diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc
index 34d10a97d31ac5efa346c22ab0a30922dd72eaf5..21c74dd829b73e92c5d96d61b569c35a5d1d67bf 100644
--- a/chrome/installer/util/master_preferences.cc
+++ b/chrome/installer/util/master_preferences.cc
@@ -12,14 +12,13 @@ namespace {
DictionaryValue* ReadJSONPrefs(const std::string& data) {
JSONStringValueSerializer json(data);
- Value* root;
- if (!json.Deserialize(&root, NULL))
+ scoped_ptr<Value> root(json.Deserialize(NULL));
+ if (!root.get())
return NULL;
- if (!root->IsType(Value::TYPE_DICTIONARY)) {
- delete root;
+ if (!root->IsType(Value::TYPE_DICTIONARY))
return NULL;
- }
- return static_cast<DictionaryValue*>(root);
+
+ return static_cast<DictionaryValue*>(root.release());
}
bool GetBooleanPref(const DictionaryValue* prefs, const std::wstring& name) {

Powered by Google App Engine
This is Rietveld 408576698