Fixed a potential memory leak related to the replay recording.