LukasKava / Minishell

0 stars 0 forks source link

memory leak when exiting twice from second level of minishel #41

Closed Gotr-byte closed 1 year ago

Gotr-byte commented 1 year ago

enter: ./minishell ./minishell ./minishell exit exit

==4251==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 1 object(s) allocated from:

0 0x7fef8b3b5867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x5625e69a35b1 in ft_split (/home/piotr/code/mini/minishell+0x1b5b1)
#2 0x5625e6990d1c in check_command_excists src/parsing/register_tokens.c:313
#3 0x5625e69914e9 in register_tokens src/parsing/register_tokens.c:378
#4 0x5625e698cd27 in parsing_and_execution src/parsing/main.c:117
#5 0x5625e698d0f6 in main src/parsing/main.c:155
#6 0x7fef8b0aed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Direct leak of 96 byte(s) in 1 object(s) allocated from:

0 0x7fef8b3b5867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x5625e69a35b1 in ft_split (/home/piotr/code/mini/minishell+0x1b5b1)
#2 0x5625e699550a in find_command_path src/parsing/parsing.c:44
#3 0x5625e69965a1 in get_the_commands src/parsing/parsing.c:204
#4 0x5625e698cd96 in parsing_and_execution src/parsing/main.c:119
#5 0x5625e698d0f6 in main src/parsing/main.c:155
#6 0x7fef8b0aed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

Indirect leak of 267 byte(s) in 11 object(s) allocated from:

0 0x7fef8b3b5867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x5625e69a36d0 in ft_strjoin (/home/piotr/code/mini/minishell+0x1b6d0)
#2 0x5625e6990eb0 in check_command_excists src/parsing/register_tokens.c:318
#3 0x5625e69914e9 in register_tokens src/parsing/register_tokens.c:378
#4 0x5625e698cd27 in parsing_and_execution src/parsing/main.c:117
#5 0x5625e698d0f6 in main src/parsing/main.c:155
#6 0x7fef8b0aed8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58

SUMMARY: AddressSanitizer: 459 byte(s) leaked in 13 allocation(s).

LukasKava commented 1 year ago

fixed the leak