Updated the main.cpp to properly deallocate the shared memory. Moved deallocation logic from child to parent.