mochida1/minishell

leaks bizarros

Closed this issue · 1 comments

  :) echo "$USER"
==59370== Invalid read of size 1
==59370==    at 0x404785: get_var_value (expand_vars.c:29)
==59370==    by 0x404824: update_token (expand_vars.c:47)
==59370==    by 0x4048F4: if_variable (expand_vars.c:65)
==59370==    by 0x4049AA: expand_variables (expand_vars.c:87)
==59370==    by 0x4049FD: handle_variable_expansions (expand_vars.c:97)
==59370==    by 0x406F9D: parse_state (parse_state.c:47)
==59370==    by 0x404366: main (minishell.c:40)
==59370==  Address 0x4ad621f is 1 bytes before a block of size 14 alloc'd
==59370==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==59370==    by 0x407E58: ft_strdup (in /nfs/homes/hmochida/projects/minishell/minishell)
==59370==    by 0x4071E1: get_env (get_env.c:31)
==59370==    by 0x406DE1: init_data (init_state.c:30)
==59370==    by 0x406E70: init_state (init_state.c:45)
==59370==    by 0x404338: main (minishell.c:36)
==59370== 
hmochida 
🦄 :) exit
exit
==59370== 
==59370== HEAP SUMMARY:
==59370==     in use at exit: 204,627 bytes in 222 blocks
==59370==   total heap usage: 1,425 allocs, 1,203 frees, 260,061 bytes allocated
==59370== 
==59370== 6 bytes in 3 blocks are definitely lost in loss record 1 of 60
==59370==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==59370==    by 0x408621: ft_itoa (in /nfs/homes/hmochida/projects/minishell/minishell)
==59370==    by 0x404514: expand_exit_code (expand_exit_code.c:58)
==59370==    by 0x4049F4: handle_variable_expansions (expand_vars.c:96)
==59370==    by 0x406F9D: parse_state (parse_state.c:47)
==59370==    by 0x404366: main (minishell.c:40)
==59370== 
==59370== 17 bytes in 4 blocks are definitely lost in loss record 10 of 60
==59370==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==59370==    by 0x407E58: ft_strdup (in /nfs/homes/hmochida/projects/minishell/minishell)
==59370==    by 0x4050B3: tokenize_splits (tokens.c:34)
==59370==    by 0x406F89: parse_state (parse_state.c:46)
==59370==    by 0x404366: main (minishell.c:40)

resolved as of 13/10 21;32