tentative de debug du leaks de testt

This commit is contained in:
Hugo LAMY
2019-12-12 23:09:27 +01:00
parent 7fd709fcac
commit f2e48e7746
3 changed files with 3 additions and 11 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/11 00:27:09 by hulamy #+# #+# */
/* Updated: 2019/12/11 00:56:54 by hulamy ### ########.fr */
/* Updated: 2019/12/12 23:01:04 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */

View File

@@ -169,28 +169,18 @@ int get_next_line(int fd, char **line)
int main(int ac, char **av)
{
int fd1;
int fd2;
int i;
char *line;
line = NULL;
fd1 = open(av[1], O_RDONLY);
fd2 = open(av[2], O_RDONLY);
if (ac < 2)
return (0);
while ((i = get_next_line(fd1, &line)) > 0)
{
printf("%i", i);
printf("%s\n",line);
free(line);
if ((i = get_next_line(fd2, &line)) > 0)
{
printf("%s\n",line);
free(line);
}
printf("%i", i);
}
printf("%i", i);
while (1);
return (0);
}

2
testt/test.txt Normal file
View File

@@ -0,0 +1,2 @@
asdfghjklasdfghjklasdfghjkl