Browse Source

[enh] mleaks for reallocation of PATH.

Moul 3 years ago
parent
commit
140e109469
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/exec.c
  2. 1 0
      src/main.c

+ 1 - 0
src/exec.c

@@ -11,6 +11,7 @@ int		manage_cmd_1(t_e *e, char **cmd)
 {
 	e->home = get_tenv(e, "HOME");
 	cmd = change_tilde_to_home(e, cmd);
+	ft_tabdel(e->path);
 	e->path = ft_strsplit(get_tenv(e, "PATH"), ':');
 	if (ft_strcmp(cmd[0], "cd") == 0)
 		cd(e, &cmd[1]);

+ 1 - 0
src/main.c

@@ -10,6 +10,7 @@ int		main(int ac, char **av, char **env)
 
 	e = (t_e*)malloc(sizeof(t_e));
 	e->env = env;
+	e->path = ft_strsplit(get_tenv(e, "PATH"), ':');
 	e->par_open = "\'\"`[({";
 	e->par_close = "\'\"`])}";
 	signal(SIGINT, sighandler);