Skip to content

Commit

Permalink
Fixed|Scripting|libcore: Memory leak when removing dictionary elements
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jan 23, 2017
1 parent f0aaeb2 commit 24d38da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions doomsday/sdk/libcore/src/data/dictionaryvalue.cpp
Expand Up @@ -277,8 +277,7 @@ void DictionaryValue::subtract(Value const &subtrahend)
throw KeyError("DictionaryValue::subtract",
"Key '" + subtrahend.asText() + "' does not exist in the dictionary");
}
delete i->second;
_elements.erase(i);
remove(i);
}

void DictionaryValue::operator >> (Writer &to) const
Expand Down Expand Up @@ -315,4 +314,4 @@ void DictionaryValue::operator << (Reader &from)
}
}

} // namespace de
} // namespace de
3 changes: 3 additions & 0 deletions doomsday/tests/test_script/main.cpp
Expand Up @@ -37,6 +37,9 @@ int main(int argc, char **argv)
#if 0
Script testScript("def returnValue(a): return a\n"
"returnValue(True) and returnValue(True)\n");
#endif
#if 0
Script testScript("print 'Dictionary:', {'a':'A', 'b':'B'} - 'a'\n");
#endif
Process proc(testScript);
LOG_MSG("Script parsing is complete! Executing...");
Expand Down

0 comments on commit 24d38da

Please sign in to comment.