rectif prompt leaks

This commit is contained in:
wescande 2017-03-19 18:02:31 +01:00
parent ac27fb4ce1
commit b7d2b120d8

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
/* Updated: 2017/03/18 14:23:53 by gwojda ### ########.fr */
/* Updated: 2017/03/19 18:02:08 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,18 +24,18 @@ static int promt_git_status(int fd)
line = ft_strdup(ft_strrchr(line, '/') + 1);
else
line = ft_strdup(line + 3);
free(tmp);
ft_strdel(&tmp);
ft_printf("\x1b[38;5;47mgit:(\x1b[38;5;203m%s\x1b[38;5;47m)", line);
if (!get_next_line(fd, &tmp))
ft_printf("\x1b[38;5;83m ✓ ");
else
{
ft_printf("\x1b[38;5;1m ✗ ");
free(tmp);
ft_strdel(&tmp);
}
while (get_next_line(fd, &tmp))
free(tmp);
free(tmp);
while (get_next_line(fd, &tmp) > 0)
ft_strdel(&tmp);
ft_strdel(&tmp);
len = ft_strlen(line);
ft_strdel(&line);
return (len + 8);