LukasKava / Minishell

0 stars 0 forks source link

fsanitize shows memory leak after exit #42

Closed Gotr-byte closed 1 year ago

Gotr-byte commented 1 year ago

Not directly after exit. But after entering levels of minishels and exiting them. The exit from the minishell produces the following leaks:

================================================================= ==4223==ERROR: LeakSanitizer: detected memory leaks

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

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

#1 0x561f8d4b25b1 in ft_split (/home/piotr/code/mini/minishell+0x1b5b1)
#2 0x561f8d49fd1c in check_command_excists src/parsing/register_tokens.c:313
#3 0x561f8d4a04e9 in register_tokens src/parsing/register_tokens.c:378
#4 0x561f8d49bd27 in parsing_and_execution src/parsing/main.c:117
#5 0x561f8d49c0f6 in main src/parsing/main.c:155
#6 0x7fbe8c0bad8f 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 0x7fbe8c3c1867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x561f8d4b25b1 in ft_split (/home/piotr/code/mini/minishell+0x1b5b1)
#2 0x561f8d4a450a in find_command_path src/parsing/parsing.c:44
#3 0x561f8d4a55a1 in get_the_commands src/parsing/parsing.c:204
#4 0x561f8d49bd96 in parsing_and_execution src/parsing/main.c:119
#5 0x561f8d49c0f6 in main src/parsing/main.c:155
#6 0x7fbe8c0bad8f 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 0x7fbe8c3c1867 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145

#1 0x561f8d4b26d0 in ft_strjoin (/home/piotr/code/mini/minishell+0x1b6d0)
#2 0x561f8d49feb0 in check_command_excists src/parsing/register_tokens.c:318
#3 0x561f8d4a04e9 in register_tokens src/parsing/register_tokens.c:378
#4 0x561f8d49bd27 in parsing_and_execution src/parsing/main.c:117
#5 0x561f8d49c0f6 in main src/parsing/main.c:155
#6 0x7fbe8c0bad8f 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 this issue