Releases allocated memory