Update main.cpp

fixed memory leak.