Skip to content

Commit

Permalink
FIX(client): Fix samples double memory address allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Oct 24, 2024
1 parent 70dea60 commit 4bf4d1c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/mumble/AudioOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,21 @@ void AudioOutput::removeUser(const ClientUser *user) {
}

void AudioOutput::removeToken(AudioOutputToken &token) {
removeBuffer(token.m_buffer);
bool stillPlaying;
{
// A AudioOutputToken user can not possibly know, if
// the pointer they are holding is still valid.
// We are protected against invalid memory access and
// double-frees. But we might run into issues, if the
// system memory allocator uses the same address in quick
// succession. See #6613
QReadLocker locker(&qrwlOutputs);
stillPlaying = qmOutputs.contains(nullptr, token.m_buffer);
}

if (stillPlaying) {
removeBuffer(token.m_buffer);
}
token = {};
}

Expand Down

0 comments on commit 4bf4d1c

Please sign in to comment.