From 1cd40a7d44c7392a69e94d9b115f3ece47895242 Mon Sep 17 00:00:00 2001 From: Antoine Riard Date: Wed, 22 Mar 2017 21:49:22 +0100 Subject: [PATCH] no leaks var --- 42sh/src/exec/exec_var.c | 7 ++++--- 42sh/src/exec/ft_exec.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/42sh/src/exec/exec_var.c b/42sh/src/exec/exec_var.c index dbeaea7c..496a3fcc 100644 --- a/42sh/src/exec/exec_var.c +++ b/42sh/src/exec/exec_var.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 11:12:05 by ariard #+# #+# */ -/* Updated: 2017/03/20 15:43:34 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 21:34:39 by ariard ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,8 +30,9 @@ int exec_var(t_btree **ast) node = (*ast)->item; av = token_to_argv(node->data.cmd.token, 1); set_var(av[0], &var, &value); - if (ft_getenv(data_singleton()->env, var)) - return (0); builtin_setenv("internal", (char*[]){"local", var, value, 0}, NULL); + ft_strdel(&var); + ft_strdel(&value); + ft_tabdel(&av); return (0); } diff --git a/42sh/src/exec/ft_exec.c b/42sh/src/exec/ft_exec.c index 38897055..5cf734ba 100644 --- a/42sh/src/exec/ft_exec.c +++ b/42sh/src/exec/ft_exec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */ -/* Updated: 2017/03/16 23:38:29 by ariard ### ########.fr */ +/* Updated: 2017/03/22 19:52:58 by ariard ### ########.fr */ /* */ /* ************************************************************************** */