transcode: fix memory leaks (audio, video)