Copy lookahead state to the stack before pushing it to the vector
Valgrind caught this. If the vector needs to grow, the original pointer will become invalid when the buffer is realloc'd
This commit is contained in:
parent
e59f6294cb
commit
1142e05873
1 changed files with 2 additions and 3 deletions
|
|
@ -335,9 +335,8 @@ static bool ts_parser__reduce(TSParser *self, int head, TSSymbol symbol,
|
|||
}
|
||||
|
||||
LOG("split_during_reduce new_head:%d", new_head);
|
||||
LookaheadState *lookahead_state =
|
||||
vector_get(&self->lookahead_states, head);
|
||||
vector_push(&self->lookahead_states, lookahead_state);
|
||||
LookaheadState lookahead_state = *(LookaheadState *)vector_get(&self->lookahead_states, head);
|
||||
vector_push(&self->lookahead_states, &lookahead_state);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue