Clean up allocated memory in JSON code

This commit is contained in:
FeRD (Frank Dana)
2019-07-11 05:00:47 -04:00
parent 8f6672be08
commit 35eb6adc55
34 changed files with 103 additions and 39 deletions

View File

@@ -106,8 +106,10 @@ void EffectBase::SetJson(string value) {
Json::CharReader* reader(rbuilder.newCharReader());
string errors;
bool success = reader->parse( value.c_str(),
bool success = reader->parse( value.c_str(),
value.c_str() + value.size(), &root, &errors );
delete reader;
if (!success)
// Raise exception
throw InvalidJSON("JSON could not be parsed (or is invalid)", "");