Skip to content

[screencast] Fix pipewire stream double free

Lewis Lakerink requested to merge lakerink/kwin:master into master

Currently if a pipewire stream connect fails in PipeWireStream::createStream, the stream is destroyed, but pwStream is not nulled.

Then in screencastmanager.cpp, the error propagates up, and in ScreencastManager::integrateStreams, because init() fails, the PipeWireStream object is immediately deleted.

In the PipeWireStream destructor, there is a check for pwStream being null. Because it has been destroyed already in createStream but not nulled, it is then destroyed again causing a malloc double free SIGABRT within pipewire.

If we correctly null pwStream if createStream fails, then this double free cannot occur.

Merge request reports