audio_thread: fix using freed memory in audio thread