diff --git a/lib/JsonParser/json-parser.ll b/lib/JsonParser/json-parser.ll index 823dbf0285..43d728ff49 100644 --- a/lib/JsonParser/json-parser.ll +++ b/lib/JsonParser/json-parser.ll @@ -229,10 +229,12 @@ static bool ParseArray (yyscan_t scanner, TRI_json_t* result) { yyextra._message = "out-of-memory"; return false; } + + // be paranoid and initialize the memory + TRI_InitNullJson(next); if (! ParseValue(scanner, next, c)) { // be paranoid - TRI_InitNullJson(next); return false; } @@ -339,10 +341,12 @@ static bool ParseObject (yyscan_t scanner, TRI_json_t* result) { next = static_cast(TRI_NextVector(&result->_value._objects)); // we made sure with the reserve call that we haven't run out of memory TRI_ASSERT_EXPENSIVE(next != nullptr); + + // be paranoid and initialize the memory + TRI_InitNullJson(next); if (! ParseValue(scanner, next, c)) { // be paranoid - TRI_InitNullJson(next); return false; } }