no leaks var

This commit is contained in:
Antoine Riard 2017-03-22 21:49:22 +01:00
parent 59d37acc61
commit 1cd40a7d44
2 changed files with 5 additions and 4 deletions

View file

@ -6,7 +6,7 @@
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */ /* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 11:12:05 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; node = (*ast)->item;
av = token_to_argv(node->data.cmd.token, 1); av = token_to_argv(node->data.cmd.token, 1);
set_var(av[0], &var, &value); set_var(av[0], &var, &value);
if (ft_getenv(data_singleton()->env, var))
return (0);
builtin_setenv("internal", (char*[]){"local", var, value, 0}, NULL); builtin_setenv("internal", (char*[]){"local", var, value, 0}, NULL);
ft_strdel(&var);
ft_strdel(&value);
ft_tabdel(&av);
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:30:32 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 */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */