summaryrefslogtreecommitdiffstats
path: root/src/m_minishell.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 19:45:42 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 19:45:42 +0200
commitaf663bf8cbc9e97d9818959de69a1d8a6c423cbe (patch)
tree0c9be9b4168d9b4172d927d2f6103e67d130f4f1 /src/m_minishell.c
parentSecured strdup (diff)
download42-minishell-af663bf8cbc9e97d9818959de69a1d8a6c423cbe.tar.gz
42-minishell-af663bf8cbc9e97d9818959de69a1d8a6c423cbe.tar.bz2
42-minishell-af663bf8cbc9e97d9818959de69a1d8a6c423cbe.tar.xz
42-minishell-af663bf8cbc9e97d9818959de69a1d8a6c423cbe.tar.zst
42-minishell-af663bf8cbc9e97d9818959de69a1d8a6c423cbe.zip
Work in progress, freed leak
Diffstat (limited to 'src/m_minishell.c')
-rw-r--r--src/m_minishell.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/m_minishell.c b/src/m_minishell.c
index e14dbdc..9306955 100644
--- a/src/m_minishell.c
+++ b/src/m_minishell.c
@@ -31,7 +31,8 @@ int
char *const envp[])
{
int32_t ret;
- char *str;
+ char *str_one;
+ char *str_two;
t_msh *msh;
/* TODO: handle general variables | $var */
@@ -41,9 +42,12 @@ int
return (FT_RET_ALLOC);
}
u_subst_var_value("$SHLVL",
- str = ft_itoa(ft_atoi(u_get_var_value("$SHLVL", msh)) + 1), msh);
- ft_memdel((void*)&str);
- lvars_add_front(&msh->vars, lvars_new("var", "value"));
+ str_one =ft_itoa(
+ ft_atoi(str_two = u_get_var_value("$SHLVL", msh)) + 1), msh);
+ ft_memdel((void*)&str_one);
+ ft_memdel((void*)&str_two);
+ /* TODO: delet this */
+ u_subst_var_value("$var", "value", msh);
ret = m_argv(argc, argv, msh);
s_destroy(msh);
return (ret);