Not everything handles errors from json parsing gracefully.  By at least
resetting the lexer, we'll start generating valid tokens again and hopefully
recover the stream.

Signed-off-by: Anthony Liguori <aligu...@us.ibm.com>

diff --git a/json-lexer.c b/json-lexer.c
index c736f42..834d7af 100644
--- a/json-lexer.c
+++ b/json-lexer.c
@@ -303,6 +303,9 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch)
             new_state = IN_START;
             break;
         case ERROR:
+            QDECREF(lexer->token);
+            lexer->token = qstring_new();
+            new_state = IN_START;
             return -EINVAL;
         default:
             break;
-- 
1.7.0.4


Reply via email to