fix doublefree ctrl_c in <<

This commit is contained in:
kinou-p 2022-04-20 14:31:45 +02:00
parent 9d6965dd13
commit 5258d6ca34
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/08 15:19:42 by apommier #+# #+# */ /* Created: 2022/03/08 15:19:42 by apommier #+# #+# */
/* Updated: 2022/04/19 18:30:14 by apommier ### ########.fr */ /* Updated: 2022/04/20 14:30:49 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -36,7 +36,7 @@ t_s_cmd *set_s_cmd(char *line, int index)
split_line = ft_split_with_quote(line, ' '); split_line = ft_split_with_quote(line, ' ');
s_cmd->nb_args = double_size(split_line); s_cmd->nb_args = double_size(split_line);
s_cmd->args = split_line; s_cmd->args = split_line;
free(line); //free(line);
return (s_cmd); return (s_cmd);
} }
@ -94,7 +94,7 @@ t_cmd *initialize_cmd(t_cmd *cmd, char **env, char **cmds, int nb)
return (0); return (0);
} }
parse_quote(cmd); parse_quote(cmd);
free(cmds); free_double(cmds);
if (cmd) if (cmd)
{ {
cmd->current_s_cmd = cmd->s_cmds[0]; cmd->current_s_cmd = cmd->s_cmds[0];

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */ /* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/03/11 16:35:37 by apommier #+# #+# */ /* Created: 2022/03/11 16:35:37 by apommier #+# #+# */
/* Updated: 2022/04/19 14:47:21 by apommier ### ########.fr */ /* Updated: 2022/04/20 14:29:10 by apommier ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,7 +23,7 @@ char *cut_str(char *str, int start, int end)
swap = ft_strjoin(&str[end], 0); swap = ft_strjoin(&str[end], 0);
str[start] = 0; str[start] = 0;
str = ft_strjoin(str, swap); str = ft_strjoin(str, swap);
free(del); //free(del);
free(swap); free(swap);
return (str); return (str);
} }