diff --git a/42sh/Makefile b/42sh/Makefile index 2a885d45..7911a273 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -84,6 +84,7 @@ exec/ft_findexec.c\ exec/is_function.c\ exec/mark_process_status.c\ exec/node_copy.c\ +exec/op_stack_free.c\ exec/pfree_cmd.c\ exec/pfree_cond.c\ exec/pfree_list.c\ diff --git a/42sh/includes/exec.h b/42sh/includes/exec.h index d9f8261e..d5e2122f 100644 --- a/42sh/includes/exec.h +++ b/42sh/includes/exec.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */ -/* Updated: 2017/03/15 01:07:00 by ariard ### ########.fr */ +/* Updated: 2017/03/15 16:06:24 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -133,6 +133,8 @@ struct s_exec int control_count; }; +void op_stack_free(void *data, size_t content_size); + int exec_reset(void); int process_setgroup(t_process *p, pid_t pid); void process_setsig(void); diff --git a/42sh/src/exec/exec_semi.c b/42sh/src/exec/exec_semi.c index c042ffb6..25a34a94 100644 --- a/42sh/src/exec/exec_semi.c +++ b/42sh/src/exec/exec_semi.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* exec_semi.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/30 20:52:05 by jhalford #+# #+# */ -/* Updated: 2017/03/10 14:55:05 by ariard ### ########.fr */ +/* Updated: 2017/03/15 15:55:43 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/instruction_free.c b/42sh/src/main/instruction_free.c index 92fd64d9..361923d1 100644 --- a/42sh/src/main/instruction_free.c +++ b/42sh/src/main/instruction_free.c @@ -1,11 +1,24 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* instruction_free.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: gwojda +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2017/03/15 15:54:59 by gwojda #+# #+# */ +/* Updated: 2017/03/15 16:06:34 by gwojda ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "minishell.h" int instruction_free(t_list **token, t_parser *parser, t_btree **ast) -{ +{ ft_lstdel(token, &token_free); token = NULL; ft_lstdel(&parser->stack, NULL); btree_del(ast, &ast_free); ft_lstdel(&data_singleton()->heredoc_queue, &redir_free); + ft_lstdel(&data_singleton()->exec.op_stack, &op_stack_free); return (0); } diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index a5bedb24..32de297e 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/03/15 13:46:36 by gwojda ### ########.fr */ +/* Updated: 2017/03/15 16:12:35 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -74,6 +74,7 @@ int handle_instruction(int fd) if (ft_exec(&ast)) return (2); instruction_free(&token, &parser, &ast); + ft_lstdel(&parser.stack, &op_stack_free); if (SH_IS_INTERACTIVE(data_singleton()->opts) && *lexer.str) ft_add_str_in_history(lexer.str); ft_strdel(&lexer.str);