Remove memory leak from the main.cpp