fix valgrind

This commit is contained in:
mcolonna 2024-06-21 14:44:55 +02:00
parent 8cfd839045
commit 92759513e8

View file

@ -6,7 +6,7 @@
/* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */ /* By: jschaft <cecile.schaft@orange.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */ /* Created: 2024/04/23 14:33:45 by mcolonna #+# #+# */
/* Updated: 2024/06/20 18:17:03 by mcolonna ### ########.fr */ /* Updated: 2024/06/21 14:44:16 by mcolonna ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -49,7 +49,6 @@ static int do_command(t_env *env, const char *str)
static void start(t_env *env) static void start(t_env *env)
{ {
env->mc_command = mem_subclass(fatal_error, env->mc_global); env->mc_command = mem_subclass(fatal_error, env->mc_global);
do_command(env, "clear");
do_command(env, "cat ./header"); do_command(env, "cat ./header");
do_command(env, "echo"); do_command(env, "echo");
mem_freeall(env->mc_command); mem_freeall(env->mc_command);
@ -63,12 +62,12 @@ static void prompt_command(t_env *env)
env->mc_command = mem_subclass(fatal_error, env->mc_global); env->mc_command = mem_subclass(fatal_error, env->mc_global);
command_str = ask_command(env); command_str = ask_command(env);
if (!command_str) if (!command_str)
{
env->exit = true; env->exit = true;
exit(0); else
} {
add_history(command_str); add_history(command_str);
do_command(env, command_str); do_command(env, command_str);
}
mem_freeall(env->mc_command); mem_freeall(env->mc_command);
env->mc_command = NULL; env->mc_command = NULL;
} }