json-lexer: reset the lexer state on an invalid token
authorAnthony Liguori <aliguori@us.ibm.com>
Wed, 1 Jun 2011 17:14:56 +0000 (12:14 -0500)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 7 Jun 2011 18:52:11 +0000 (13:52 -0500)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
json-lexer.c

index fe5a060..a5bbe9e 100644 (file)
@@ -305,6 +305,9 @@ static int json_lexer_feed_char(JSONLexer *lexer, char ch)
             new_state = IN_START;
             break;
         case IN_ERROR:
+            QDECREF(lexer->token);
+            lexer->token = qstring_new();
+            new_state = IN_START;
             return -EINVAL;
         default:
             break;