mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-19 06:04:16 +00:00
red_worker: Check for NULL watches
If we run out of watches slots, we return NULL from watch_add, which means that the other watch_foo functions may get called with a NULL parameter, protect them against this. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
42ac95e125
commit
914e50814f
@ -9514,8 +9514,15 @@ static int common_channel_config_socket(RedChannelClient *rcc)
|
||||
|
||||
static void worker_watch_update_mask(SpiceWatch *watch, int event_mask)
|
||||
{
|
||||
struct RedWorker *worker = watch->worker;
|
||||
int i = watch - worker->watches;
|
||||
struct RedWorker *worker;
|
||||
int i;
|
||||
|
||||
if (!watch) {
|
||||
return;
|
||||
}
|
||||
|
||||
worker = watch->worker;
|
||||
i = watch - worker->watches;
|
||||
|
||||
worker->poll_fds[i].events = 0;
|
||||
if (event_mask & SPICE_WATCH_EVENT_READ) {
|
||||
@ -9561,6 +9568,10 @@ static SpiceWatch *worker_watch_add(int fd, int event_mask, SpiceWatchFunc func,
|
||||
|
||||
static void worker_watch_remove(SpiceWatch *watch)
|
||||
{
|
||||
if (!watch) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Note we don't touch the poll_fd here, to avoid the
|
||||
poll_fds/watches table entry getting re-used in the same
|
||||
red_worker_main loop over the fds as it is removed.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user