From cfb1999cafc2a4da742ffb3b2669ce0731a93cb7 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Wed, 18 Oct 2023 16:18:54 +0200 Subject: [PATCH] soundserver: fix double freeing. --- devices/sound/soundserver.cpp | 3 +++ devices/sound/soundserver.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/devices/sound/soundserver.cpp b/devices/sound/soundserver.cpp index 42b48a9..ebcd2a9 100644 --- a/devices/sound/soundserver.cpp +++ b/devices/sound/soundserver.cpp @@ -117,6 +117,8 @@ void SoundServer::shutdown() case SND_STREAM_OPENED: close_out_stream(); /* fall through */ + case SND_STREAM_CLOSED: + /* fall through */ case SND_SERVER_UP: /* fall through */ case SND_API_READY: @@ -219,5 +221,6 @@ void SoundServer::close_out_stream() { cubeb_stream_stop(this->out_stream); cubeb_stream_destroy(this->out_stream); + this->status = SND_STREAM_CLOSED; LOG_F(9, "Sound output stream closed."); } diff --git a/devices/sound/soundserver.h b/devices/sound/soundserver.h index 71f3bed..2b0dd7a 100644 --- a/devices/sound/soundserver.h +++ b/devices/sound/soundserver.h @@ -41,7 +41,8 @@ enum { SND_SERVER_DOWN = 0, SND_API_READY, SND_SERVER_UP, - SND_STREAM_OPENED + SND_STREAM_OPENED, + SND_STREAM_CLOSED };