Skip to content

Commit

Permalink
Fix a leak in JSONParser::Parse when using hidden root optimizations.
Browse files Browse the repository at this point in the history
BUG=121469
TEST=Valgrind base_unittests
TBR=mark@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10386168

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137447 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rsesek@chromium.org committed May 16, 2012
1 parent 60513bb commit 86cac20
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/json/json_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ Value* JSONParser::Parse(const std::string& input) {
// hidden root.
if (!(options_ & JSON_DETACHABLE_CHILDREN)) {
if (root->IsType(Value::TYPE_DICTIONARY)) {
return new DictionaryHiddenRootValue(&input_copy, root.release());
return new DictionaryHiddenRootValue(&input_copy, root.get());
} else if (root->IsType(Value::TYPE_LIST)) {
return new ListHiddenRootValue(&input_copy, root.release());
return new ListHiddenRootValue(&input_copy, root.get());
} else if (root->IsType(Value::TYPE_STRING)) {
// A string type could be a JSONStringValue, but because there's no
// corresponding HiddenRootValue, the memory will be lost. Deep copy to
Expand Down

0 comments on commit 86cac20

Please sign in to comment.