From 85bf84e1bbda2d2b77813926b6f4636552c575d4 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 29 Jan 2015 11:43:25 +0100 Subject: [PATCH] initialize memory --- lib/JsonParser/json-parser.ll | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; } }