From 3d9ea0bb6ba5e94949444e8f848008b4dbe80a49 Mon Sep 17 00:00:00 2001 From: Marc-Andre Lureau Date: Thu, 14 Jan 2016 22:01:07 +0100 Subject: channel: do not call pipe_add with null items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the creator was not able to produce the item, no need to call pipe_add(). Signed-off-by: Marc-André Lureau Acked-by: Frediano Ziglio --- server/red-channel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server') diff --git a/server/red-channel.c b/server/red-channel.c index 9ea7ca50..fd414933 100644 --- a/server/red-channel.c +++ b/server/red-channel.c @@ -2233,7 +2233,7 @@ typedef int (*rcc_item_cond_t)(RedChannelClient *rcc, PipeItem *item); * @channel: a channel * @creator: a callback to create pipe item (not null) * @data: the data to pass to the creator - * @pipe_add: a callback to add pipe items (not null) + * @pipe_add: a callback to add non-null pipe items (not null) **/ static void red_channel_pipes_create_batch(RedChannel *channel, new_pipe_item_t creator, void *data, @@ -2250,7 +2250,9 @@ static void red_channel_pipes_create_batch(RedChannel *channel, RING_FOREACH_SAFE(link, next, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); item = (*creator)(rcc, data, num++); - (*pipe_add)(rcc, item); + if (item) { + (*pipe_add)(rcc, item); + } } } -- cgit v1.2.3