Releaseing the allocated object to avoid a memory leak.