mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
pulse-server: handle message errors
This commit is contained in:
parent
bb8bd3d76d
commit
bc1192c8dd
2 changed files with 21 additions and 0 deletions
|
|
@ -272,6 +272,17 @@ static int send_message(struct client *client, struct message *m)
|
|||
struct impl *impl = client->impl;
|
||||
int res;
|
||||
|
||||
if (m == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
if (m->length == 0) {
|
||||
res = 0;
|
||||
goto error;
|
||||
} else if (m->length > m->allocated) {
|
||||
res = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
m->offset = 0;
|
||||
spa_list_append(&client->out_messages, &m->link);
|
||||
res = flush_messages(client);
|
||||
|
|
@ -282,6 +293,10 @@ static int send_message(struct client *client, struct message *m)
|
|||
res = 0;
|
||||
}
|
||||
return res;
|
||||
error:
|
||||
if (m)
|
||||
message_free(client, m, false, false);
|
||||
return res;
|
||||
}
|
||||
|
||||
static struct message *reply_new(struct client *client, uint32_t tag)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue