Properly deallocation of memory.