Prevent NULL pointer dereference in parser__accept
parser__select_tree can return true if 'left != NULL' and 'right == NULL' which
will later cause a NULL ptr deref:
src/runtime/parser.c:842:14: warning: Access to field 'ref_count' results in a dereference of a null pointer (loaded from variable 'root')
assert(root->ref_count > 0);
^~~~~~~~~~~~~~~
This commit is contained in:
parent
da099d0bbe
commit
d1b19e8196
1 changed files with 1 additions and 1 deletions
|
|
@ -839,7 +839,7 @@ static void parser__accept(Parser *self, StackVersion version,
|
|||
|
||||
if (parser__select_tree(self, self->finished_tree, root)) {
|
||||
ts_tree_release(self->finished_tree);
|
||||
assert(root->ref_count > 0);
|
||||
assert((root == NULL) || (root->ref_count > 0));
|
||||
self->finished_tree = root;
|
||||
} else {
|
||||
ts_tree_release(root);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue