So, I have made a function to reverse a linked list using recursion. My reverse function is working perfectly, but when I try to run asan on my executable, it is giving me a stack-overflow error at a particular address in the reverse function. I have tried everything to fix it. I tried to make all the variables in the stack NULL after their work is done. I have de-allocated all the memory from the heap. I ran valgrind on the file and it tells me all the memory has been freed and there is no leak. What do I do?
AddressSanitizer: stack-overflow
P.S. I am using clang++ compiler in C++.