C-Plus-Plus
                                
                                 C-Plus-Plus copied to clipboard
                                
                                    C-Plus-Plus copied to clipboard
                            
                            
                            
                        fix: remove memory leak in stack
Description of Change
I added the member function deleteAllNodes() into the stack and applied it in the destructor, assignment operator and in the clear method. I have applied address sanitizer and valgrind on test_stack.cpp and test_stack_students.cpp - no further leaks were found. The mentioned files, are the only ones using stack.h.
Checklist
- [x] Added description of change
- [x] Relevant documentation/comments is changed or added
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes: 
Quickfix of the memory leak in stack.h.
As top(), display() and isEmptyStack() are non modifying methods, you can qualify them with const.
Agree - this implementation needs some cleaning - making it const correct and really testable is something what should be done quickly. But I think this is beyond the scope if this PR.
To remove a few
clang-tidyerrors, please change the filename tostack.hpp. You might need to update other instances as well.
This change indeed suppressed the errors. But as discussed above: this implementation needs a cleanup.
The entire Awesome CI Workflow  run on my side. @Panquesito7 could you please approve the run on your end?
Would you like to work on these files and improve them to our standards? That would fit for another PR, of course.
Would you like to work on these files and improve them to our standards? That would fit for another PR, of course.
I could do that. However there are few things, which I would like to clarify before:
- tests: should I use some framework for writing them (something like GoogleTest or Boost.Test). I realize that this is a bigger topic.
- I think for the educational purposes it might be a good idea to stay with raw pointers instead of using smart pointer. Do you agree?
- there is a similar memory leak in queue.h(cf. #2417).
Would you like to work on these files and improve them to our standards? That would fit for another PR, of course.
I could do that. However there are few things, which I would like to clarify before:
- tests: should I use some framework for writing them (something like GoogleTest or Boost.Test). I realize that this is a bigger topic.
- I think for the educational purposes it might be a good idea to stay with raw pointers instead of using smart pointer. Do you agree?
- there is a similar memory leak in
queue.h.
- I haven't heard of that tool, but if it makes good self-test implementations @tjgurwara99, thoughts?
- Smart pointers are used in modern C++ which we should stick to, IMHO. This will also help others learn smart pointers and make the CI happy as well.
- Great finding, thank you! Feel free to fix that if you like in another PR. :)
@Panquesito7 I changed the implementation to use std::shared_ptr and added test_stack.cpp. The old tests are now in test_stack_legacy.cpp.
I think now it everything is ready to be merged.