When an unclosed quotes are detected, tokenization fails. This causes
double free because the current_token is appended to tokens (because
current_token.size > 0) and is freed 4 lines below. The double free
happens when the tokens vector frees its memory.
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/21 16:34:43 by ljiriste #+# #+# */
-/* Updated: 2024/08/26 12:07:29 by ljiriste ### ########.fr */
+/* Updated: 2024/08/26 16:16:11 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
else
res = ft_vec_append(¤t_token, line[0] + (i++)) != success;
}
- if (current_token.size > 0)
+ if (current_token.size > 0 && !res)
{
ft_vec_append(¤t_token, "");
token.type = (char *)get_token_type(current_token.vec, '\0');