Skip to content

Commit

Permalink
fix infinity loop if json_parse fails
Browse files Browse the repository at this point in the history
  • Loading branch information
recp committed Dec 10, 2019
1 parent 2d4b48a commit 64cd409
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/json/impl/impl_json.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ json_parse(const char * __restrict contents, bool reverse) {
} while ((c = *p) != '\0' && (c = *++p) != '\0');

err:
if (tmproot.value)
if (tmproot.value) {
((json_t *)tmproot.value)->parent = NULL;
((json_t *)tmproot.value)->next = NULL;
}

doc->root = tmproot.value;
return doc;
Expand Down

0 comments on commit 64cd409

Please sign in to comment.