fixe leak sur env

This commit is contained in:
gwojda 2017-02-17 10:32:25 +01:00
parent ec9f2c91f3
commit 0f61c048ae
4 changed files with 7 additions and 6 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/28 14:14:20 by jhalford #+# #+# */ /* Created: 2016/11/28 14:14:20 by jhalford #+# #+# */
/* Updated: 2017/02/16 12:40:08 by gwojda ### ########.fr */ /* Updated: 2017/02/17 10:27:05 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -131,5 +131,6 @@ int builtin_env(const char *path, char *const argv[], char *const envp[])
if (*argv) if (*argv)
++argv; ++argv;
} }
ft_sstrfree(env);
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */ /* Created: 2017/02/02 15:22:19 by gwojda #+# #+# */
/* Updated: 2017/02/09 16:24:02 by jhalford ### ########.fr */ /* Updated: 2017/02/16 16:12:59 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */ /* Created: 2016/12/13 13:51:33 by gwojda #+# #+# */
/* Updated: 2017/02/16 12:38:58 by gwojda ### ########.fr */ /* Updated: 2017/02/16 14:27:57 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -71,7 +71,7 @@ static int ft_currend_dir(void)
env = data_singleton()->env; env = data_singleton()->env;
if (!(pwd = ft_getenv(env, "PWD"))) if (!(pwd = ft_getenv(env, "PWD")))
return (0); return (-1);
if (ft_getenv(env, "HOME") && !ft_strcmp(pwd, ft_getenv(env, "HOME"))) if (ft_getenv(env, "HOME") && !ft_strcmp(pwd, ft_getenv(env, "HOME")))
{ {
ft_printf("%c ", '~'); ft_printf("%c ", '~');

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */ /* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/07 11:00:28 by gwojda #+# #+# */ /* Created: 2017/01/07 11:00:28 by gwojda #+# #+# */
/* Updated: 2017/02/14 14:43:32 by gwojda ### ########.fr */ /* Updated: 2017/02/16 16:05:40 by gwojda ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -25,7 +25,7 @@ void ft_puttermcaps(char *str)
char *res; char *res;
char *env; char *env;
env = getenv("TERM"); env = ft_getenv(data_singleton()->env, "TERM");
if ((res = tgetstr(str, &env)) == NULL) if ((res = tgetstr(str, &env)) == NULL)
return ; return ;
tputs(res, 0, ft_put); tputs(res, 0, ft_put);