Fix memory leak in subtitle code