Fixed a leak using hmap_<name>_remove

This commit is contained in:
Maix0 2024-08-12 17:15:13 +02:00
parent 6a504cab3e
commit 132d7d8bc7
3 changed files with 10 additions and 6 deletions

View file

@ -6,11 +6,12 @@
/* By: maiboyer <maiboyer@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/10 18:43:18 by maiboyer #+# #+# */
/* Updated: 2024/08/11 11:26:16 by maiboyer ### ########.fr */
/* Updated: 2024/08/12 17:11:12 by maiboyer ### ########.fr */
/* */
/* ************************************************************************** */
#include "exec/builtins.h"
#include "me/hashmap/hashmap_env.h"
#include "me/printf/printf.h"
#include "me/str/str.h"
#include "me/string/string.h"
@ -18,5 +19,10 @@
t_error builtin_unset_(t_state *state, t_builtin_spawn_info info, t_i32 *exit_code)
{
return (*exit_code = 0, ERROR);
t_usize i;
i = 1;
while (i < info.args.len)
hmap_env_remove(state->env, &info.args.buffer[i++]);
return (*exit_code = 0, NO_ERROR);
}