*[main][/minishell]$ val ./minishell
minishell$
minishell$ cd ..
minishell$
exit
==2779== Memcheck, a memory error detector
==2779== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==2779== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==2779== Command: ./minishell
==2779== Parent PID: 1
==2779==
==2779== Invalid read of size 1
==2779== at 0x111476: ft_strlen (in /minishell/minishell)
==2779== by 0x111AD6: ft_strdup (in /minishell/minishell)
==2779== by 0x11060A: env_add (env_utils.c:48)
==2779== by 0x10B375: update_env (cd.c:61)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Address 0x4b117e0 is 0 bytes inside a block of size 11 free'd
==2779== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x1105FE: env_add (env_utils.c:47)
==2779== by 0x10B355: update_env (cd.c:60)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Block was alloc'd at
==2779== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x111CC7: ft_x_malloc (in /minishell/minishell)
==2779== by 0x111A35: ft_substr (in /minishell/minishell)
==2779== by 0x110308: init_env (environment.c:33)
==2779== by 0x10A634: main (main.c:30)
==2779==
==2779== Invalid read of size 1
==2779== at 0x112FA3: ft_memcpy (in /minishell/minishell)
==2779== by 0x111B13: ft_strdup (in /minishell/minishell)
==2779== by 0x11060A: env_add (env_utils.c:48)
==2779== by 0x10B375: update_env (cd.c:61)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Address 0x4b117e0 is 0 bytes inside a block of size 11 free'd
==2779== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x1105FE: env_add (env_utils.c:47)
==2779== by 0x10B355: update_env (cd.c:60)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Block was alloc'd at
==2779== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x111CC7: ft_x_malloc (in /minishell/minishell)
==2779== by 0x111A35: ft_substr (in /minishell/minishell)
==2779== by 0x110308: init_env (environment.c:33)
==2779== by 0x10A634: main (main.c:30)
==2779==
==2779==
==2779== HEAP SUMMARY:
==2779== in use at exit: 208,133 bytes in 222 blocks
==2779== total heap usage: 780 allocs, 558 frees, 299,362 bytes allocated
==2779==
==2779== LEAK SUMMARY:
==2779== definitely lost: 0 bytes in 0 blocks
==2779== indirectly lost: 0 bytes in 0 blocks
==2779== possibly lost: 0 bytes in 0 blocks
==2779== still reachable: 208,133 bytes in 222 blocks
==2779== suppressed: 0 bytes in 0 blocks
==2779== Reachable blocks (those to which a pointer was found) are not shown.
==2779== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==2779==
==2779== ERROR SUMMARY: 22 errors from 2 contexts (suppressed: 0 from 0)
==2779==
==2779== 11 errors in context 1 of 2:
==2779== Invalid read of size 1
==2779== at 0x112FA3: ft_memcpy (in /minishell/minishell)
==2779== by 0x111B13: ft_strdup (in /minishell/minishell)
==2779== by 0x11060A: env_add (env_utils.c:48)
==2779== by 0x10B375: update_env (cd.c:61)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Address 0x4b117e0 is 0 bytes inside a block of size 11 free'd
==2779== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x1105FE: env_add (env_utils.c:47)
==2779== by 0x10B355: update_env (cd.c:60)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Block was alloc'd at
==2779== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x111CC7: ft_x_malloc (in /minishell/minishell)
==2779== by 0x111A35: ft_substr (in /minishell/minishell)
==2779== by 0x110308: init_env (environment.c:33)
==2779== by 0x10A634: main (main.c:30)
==2779==
==2779==
==2779== 11 errors in context 2 of 2:
==2779== Invalid read of size 1
==2779== at 0x111476: ft_strlen (in /minishell/minishell)
==2779== by 0x111AD6: ft_strdup (in /minishell/minishell)
==2779== by 0x11060A: env_add (env_utils.c:48)
==2779== by 0x10B375: update_env (cd.c:61)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Address 0x4b117e0 is 0 bytes inside a block of size 11 free'd
==2779== at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x1105FE: env_add (env_utils.c:47)
==2779== by 0x10B355: update_env (cd.c:60)
==2779== by 0x10B2B9: exec_cd (cd.c:47)
==2779== by 0x10ECC2: exec_builtin (builtin.c:108)
==2779== by 0x10EB42: launch_builtin (builtin.c:28)
==2779== by 0x10E126: exec_pipeline (exec_pipeline.c:48)
==2779== by 0x10E069: exec_tree (exec_pipeline.c:27)
==2779== by 0x10A920: exec_line (main.c:118)
==2779== by 0x10A806: interactive_shell (main.c:92)
==2779== by 0x10A665: main (main.c:32)
==2779== Block was alloc'd at
==2779== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==2779== by 0x111CC7: ft_x_malloc (in /minishell/minishell)
==2779== by 0x111A35: ft_substr (in /minishell/minishell)
==2779== by 0x110308: init_env (environment.c:33)
==2779== by 0x10A634: main (main.c:30)
==2779==
==2779== ERROR SUMMARY: 22 errors from 2 contexts (suppressed: 0 from 0)