ft_lstclear fonctionne avec une function dell null, joinfree free les deux elements, gnl dup l'element qui sera free par joinfree

This commit is contained in:
hugogogo
2021-06-27 13:31:43 +02:00
parent f1ce5b8b9e
commit 26147eeeeb
6 changed files with 9 additions and 8 deletions

View File

@@ -123,7 +123,7 @@ int get_next_line(const int fd, char **line)
if ((ret = read(fd, buf, BUFFER_SIZE)) < 0)
return (free_lst(&lst, -1));
buf[ret] = '\0';
if (!(lst->str = ft_strjoinfree(lst->str, buf)))
if (!(lst->str = ft_strjoinfree(lst->str, ft_strdup(buf))))
return (free_lst(&lst, -1));
}
if (str != NULL)