Commit 61346066 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

The "cur" pointer is valid in the first iteration

parent e5f11931
...@@ -346,9 +346,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -346,9 +346,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
done: done:
/* Message is done when root object is done */ /* Message is done when root object is done */
while (stackidx >= 0) { do {
/* Move to nested object when we see an incomplete array */ /* Move to nested object when we see an incomplete array */
cur = &stack[stackidx];
if (cur->type == REDIS_ARRAY_T && cur->remaining) { if (cur->type == REDIS_ARRAY_T && cur->remaining) {
RESET_PROTOCOL_T(&stack[++stackidx]); RESET_PROTOCOL_T(&stack[++stackidx]);
cur->remaining--; cur->remaining--;
...@@ -360,8 +359,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons ...@@ -360,8 +359,8 @@ size_t redis_parser_execute(redis_parser_t *parser, redis_protocol_t **dst, cons
stack[stackidx-1].plen += cur->plen; stack[stackidx-1].plen += cur->plen;
} }
stackidx--; cur = &stack[--stackidx];
} } while (stackidx >= 0);
/* Always move back to start state */ /* Always move back to start state */
state = s_type_char; state = s_type_char;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment