From af663bf8cbc9e97d9818959de69a1d8a6c423cbe Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Thu, 30 Jul 2020 19:45:42 +0200 Subject: Work in progress, freed leak --- src/m_minishell.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/m_minishell.c') 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); -- cgit v1.2.3