Commit 8950b781 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧 Committed by Aleix Pol Gonzalez
Browse files

pipewire: Don't crash if we're passed a null spa_data

I just had that crash, this is what coredumpctl suggested it was
We don't need to make sure we're in dmabuf mode to remove the buffer.
Worst case scenario it won't remove anything. Check the spa_data before
querying in case it's null.
parent 11c3ada1
...@@ -158,13 +158,11 @@ void PipeWireStream::onStreamAddBuffer(void *data, pw_buffer *buffer) ...@@ -158,13 +158,11 @@ void PipeWireStream::onStreamAddBuffer(void *data, pw_buffer *buffer)
void PipeWireStream::onStreamRemoveBuffer(void *data, pw_buffer *buffer) void PipeWireStream::onStreamRemoveBuffer(void *data, pw_buffer *buffer)
{ {
PipeWireStream *stream = static_cast<PipeWireStream *>(data); PipeWireStream *stream = static_cast<PipeWireStream *>(data);
struct spa_buffer *spa_buffer = buffer->buffer; struct spa_buffer *spa_buffer = buffer->buffer;
struct spa_data *spa_data = spa_buffer->datas; struct spa_data *spa_data = spa_buffer->datas;
if (spa_data && spa_data->type == SPA_DATA_MemFd) {
if (spa_data->type == SPA_DATA_DmaBuf) {
} else if (spa_data->type == SPA_DATA_MemFd) {
munmap (spa_data->data, spa_data->maxsize); munmap (spa_data->data, spa_data->maxsize);
close (spa_data->fd); close (spa_data->fd);
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment