mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-13 05:33:55 -04:00
client-node: avoid using invalid fd or mem in clear_data
Don't close an -1 fd in clear_data. If we let the client allocate buffer, set our fd and data to invalid values. If the client decides to renegotiate before we get the buffer data we might otherwise try to clear the mem_id (default 0) or close the fd (also default 0). Fixes #5162
This commit is contained in:
parent
6a3ac7f7b0
commit
7ecd51dc80
1 changed files with 6 additions and 2 deletions
|
|
@ -263,7 +263,8 @@ static void clear_data(struct impl *impl, struct spa_data *d)
|
|||
case SPA_DATA_DmaBuf:
|
||||
case SPA_DATA_SyncObj:
|
||||
pw_log_debug("%p: close fd:%d", impl, (int)d->fd);
|
||||
close(d->fd);
|
||||
if (d->fd != -1)
|
||||
close(d->fd);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -865,8 +866,11 @@ do_port_use_buffers(struct impl *impl,
|
|||
|
||||
memcpy(&b->datas[j], d, sizeof(struct spa_data));
|
||||
|
||||
if (flags & SPA_NODE_BUFFERS_FLAG_ALLOC)
|
||||
if (flags & SPA_NODE_BUFFERS_FLAG_ALLOC) {
|
||||
b->datas[j].fd = -1;
|
||||
b->datas[j].data = SPA_UINT32_TO_PTR(SPA_ID_INVALID);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (d->type) {
|
||||
case SPA_DATA_DmaBuf:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue