This is only visible in valgrind, but see the last line '6 errors from 6 contexts'
[leaks][/minishell]$ val ./minishell
minishell$ unset LANGUAGE
minishell$
exit
==795== HEAP SUMMARY:
==795== in use at exit: 208,133 bytes in 222 blocks
==795== total heap usage: 956 allocs, 737 frees, 338,456 bytes allocated
==795==
==795== LEAK SUMMARY:
==795== definitely lost: 0 bytes in 0 blocks
==795== indirectly lost: 0 bytes in 0 blocks
==795== possibly lost: 0 bytes in 0 blocks
==795== still reachable: 208,133 bytes in 222 blocks
==795== suppressed: 0 bytes in 0 blocks
==795== Reachable blocks (those to which a pointer was found) are not shown.
==795== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==795==
==795== For lists of detected and suppressed errors, rerun with: -s
==795== ERROR SUMMARY: 6 errors from 6 contexts (suppressed: 0 from 0)
the errors look like this
==795== Invalid read of size 8
==795== at 0x10D818: env_cleanup (t_env.c:47)
==795== by 0x10D867: env_cleanup_all (t_env.c:63)
==795== by 0x10A670: main (main.c:33)
==795== Address 0x4b100e0 is 0 bytes inside a block of size 24 free'd
==795== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==795== by 0x10D83E: env_cleanup (t_env.c:50)
==795== by 0x110706: env_remove (env_utils.c:81)
==795== by 0x10B1C1: exec_unset (unset.c:36)
==795== by 0x10ECB6: exec_builtin (builtin.c:108)
==795== by 0x10EB36: launch_builtin (builtin.c:28)
==795== by 0x10E11A: exec_pipeline (exec_pipeline.c:48)
==795== by 0x10E05D: exec_tree (exec_pipeline.c:27)
==795== by 0x10A914: exec_line (main.c:116)
==795== by 0x10A7FD: interactive_shell (main.c:90)
==795== by 0x10A65F: main (main.c:31)
==795== Block was alloc'd at
==795== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==795== by 0x10F47F: x_malloc (utils_1.c:22)
==795== by 0x10D798: env_factory (t_env.c:24)
==795== by 0x110314: init_env (environment.c:32)
==795== by 0x10A634: main (main.c:29)
==795==
==795== Invalid free() / delete / delete[] / realloc()
==795== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==795== by 0x10D822: env_cleanup (t_env.c:47)
==795== by 0x10D867: env_cleanup_all (t_env.c:63)
==795== by 0x10A670: main (main.c:33)
==795== Address 0x4b10040 is 0 bytes inside a block of size 9 free'd
==795== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==795== by 0x10D822: env_cleanup (t_env.c:47)
==795== by 0x110706: env_remove (env_utils.c:81)
==795== by 0x10B1C1: exec_unset (unset.c:36)
==795== by 0x10ECB6: exec_builtin (builtin.c:108)
==795== by 0x10EB36: launch_builtin (builtin.c:28)
==795== by 0x10E11A: exec_pipeline (exec_pipeline.c:48)
==795== by 0x10E05D: exec_tree (exec_pipeline.c:27)
==795== by 0x10A914: exec_line (main.c:116)
==795== by 0x10A7FD: interactive_shell (main.c:90)
==795== by 0x10A65F: main (main.c:31)
==795== Block was alloc'd at
==795== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==795== by 0x111CAC: ft_x_malloc (in /minishell/minishell)
==795== by 0x111A1A: ft_substr (in /minishell/minishell)
==795== by 0x1102C5: init_env (environment.c:32)
==795== by 0x10A634: main (main.c:29)
This is only visible in valgrind, but see the last line '6 errors from 6 contexts'
the errors look like this