fix: leak with > but no file

This commit is contained in:
Camille Chauvet 2023-02-17 13:21:50 +01:00
parent 38e1b9834f
commit 642af26133
107 changed files with 11 additions and 8 deletions

Binary file not shown.

BIN
cmd.o

Binary file not shown.

6
cmds.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 14:17:26 by cchauvet #+# #+# */
/* Updated: 2023/02/17 13:06:35 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 13:09:13 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -101,10 +101,8 @@ static int ft_cmds_fill(t_list **cmds, t_list **env, const char *line)
return (0);
}
t_list **ft_parse_cmds(char *line, t_list **env)
t_list **ft_parse_cmds(char *line, t_list **env, int infile, int outfile)
{
int infile;
int outfile;
t_list **cmds;
cmds = malloc(sizeof(t_list *));

BIN
cmds.o

Binary file not shown.

BIN
env.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
file.o

Binary file not shown.

BIN
heredoc.o

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 17:52:10 by cchauvet #+# #+# */
/* Updated: 2023/02/16 17:52:29 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 13:19:09 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -33,6 +33,7 @@ static int ft_infile_is_valid(const char *line)
if (tab[i][0] == '<')
{
ft_eprintf("minishell: %s: must be followed by an infile\n", tab[i]);
ft_freer_tab_ultimate(1, tab);
return (0);
}
ft_freer_tab_ultimate(1, tab);

BIN
infile.o

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
main.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
/* Updated: 2023/02/17 13:05:54 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 13:13:19 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,6 +45,7 @@ int main(int ac, char **av, char **env)
ft_lstclear(data.env, env_del);
free(data.env);
free(line);
return (1);
}
infile = ft_infile(line);
if (infile == -2)
@ -53,6 +54,7 @@ int main(int ac, char **av, char **env)
ft_lstclear(data.env, env_del);
free(data.env);
free(line);
return (1);
}
cmds = ft_parse_cmds(line, data.env, infile, outfile);
if (cmds == NULL)

BIN
main.o

Binary file not shown.

BIN
minishell

Binary file not shown.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 18:01:07 by cchauvet #+# #+# */
/* Updated: 2023/02/16 17:53:28 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 13:19:46 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -32,6 +32,7 @@ static int ft_outfile_is_valid(const char *line)
if (tab[i][0] == '>')
{
ft_eprintf("minishell: %s: must be followed by an infile\n", tab[i]);
ft_freer_tab_ultimate(1, tab);
return (0);
}
ft_freer_tab_ultimate(1, tab);

BIN
outfile.o

Binary file not shown.

BIN
spacer.o

Binary file not shown.

View File

@ -71,6 +71,7 @@ static int ft_special_char_dub(const char *str)
}
i = i + y;
}
else
i++;
}
return (0);

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More