free lst et string
This commit is contained in:
@@ -121,6 +121,7 @@ void free_lst(t_gnlist **lst, const int fd)
|
||||
tmp = *lst;
|
||||
while ((*lst)->next && (*lst)->next->lfd != fd)
|
||||
(*lst) = (*lst)->next;
|
||||
free(tmp->string);
|
||||
free(tmp);
|
||||
(*lst)->next = (*lst)->next->next;
|
||||
}
|
||||
@@ -148,16 +149,6 @@ int get_next_line(const int fd, char **line)
|
||||
return (-1);
|
||||
if (*(lst->string) && ++ret == 1)
|
||||
(lst->string)[0] = '\0';
|
||||
// free(lst);
|
||||
// lst = lst->next;
|
||||
// while (lst->next->lfd != fd)
|
||||
// lst = lst->next;
|
||||
// lst->next = lst->next->next;
|
||||
// free(lst->next);
|
||||
|
||||
// while (lst->next && lst->next->lfd != fd)
|
||||
// lst = lst->next;
|
||||
// free(lst->next);
|
||||
// lst->next = lst->next->next;
|
||||
free_lst(&lst, fd);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user