educative.io

Memory Leaks and uninitialized variables in the Solution

Memory Leak #1: The solution does not delete the memory of the combined list in main.

Memory Leak#2: The solution dos not delete the dummy LinkedListNode in function merge2Countries()

Also the code does not always initialize arbitraryPointer, so if the LinkedListNode destructor is called you will get runtime error on line “delete this->arbitraryPointer;”

Key is not always initialized.


Course: Decode the Coding Interview in C++: Real-World Examples - Learn Interactively
Lesson: Feature #2: Fetch Top Movies - Decode the Coding Interview in C++: Real-World Examples