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