Because the goto_tokens used tokens from table instead of their copies
and were freed when generator states were cleared, the table tokens
then contained pointers to freed memory which were to be used.
There are two ways to fix this. Either not free the tokens in
goto_tokens or append copies. I opted for the latter because every part
of the generator code uses copies too. It may be rewritten to use the
table tokens later on to save memory.
/* By: ljiriste <ljiriste@student.42prague.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/27 11:16:53 by ljiriste #+# #+# */
-/* Updated: 2024/07/05 12:20:24 by ljiriste ### ########.fr */
+/* Updated: 2024/07/07 09:17:53 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
else
ft_vec_free(&new_kernel, void_free_item);
ft_vec_append(&state->goto_states, &state_num);
- ft_vec_append(&state->goto_tokens, token);
+ append_token(&state->goto_tokens, token);
}
}
return (success);