correction deux erreurs free avant return 0 et free list avant utilisation
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/12/16 14:08:36 by hulamy #+# #+# */
|
||||
/* Updated: 2019/12/16 14:25:08 by hulamy ### ########.fr */
|
||||
/* Updated: 2019/12/21 00:29:07 by hulamy ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -122,8 +122,8 @@ void free_lst(t_gnlist **lst, const int fd)
|
||||
while ((*lst)->next && (*lst)->next->lfd != fd)
|
||||
(*lst) = (*lst)->next;
|
||||
free(tmp->string);
|
||||
free(tmp);
|
||||
(*lst)->next = (*lst)->next->next;
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
int get_next_line(const int fd, char **line)
|
||||
@@ -149,6 +149,7 @@ int get_next_line(const int fd, char **line)
|
||||
return (-1);
|
||||
if (*(lst->string) && ++ret == 1)
|
||||
(lst->string)[0] = '\0';
|
||||
free_lst(&lst, fd);
|
||||
else
|
||||
free_lst(&lst, fd);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user