summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2012-05-20 13:27:31 +0300
committerYonit Halperin <yhalperi@redhat.com>2012-05-21 09:08:50 +0300
commit038ae54b1c4c43a63d346bdfe2db52b48f20a22e (patch)
tree5ebaecb5475850a35154e7551ed7f7c3b3003c2d
parent1b9162b5cfe4043df851e8ecaa503b8261ba5868 (diff)
downloadspice-038ae54b1c4c43a63d346bdfe2db52b48f20a22e.tar.gz
spice-038ae54b1c4c43a63d346bdfe2db52b48f20a22e.tar.xz
spice-038ae54b1c4c43a63d346bdfe2db52b48f20a22e.zip
server: handle red_channel_client_create returning NULL
-rw-r--r--server/inputs_channel.c3
-rw-r--r--server/main_channel.c2
-rw-r--r--server/red_tunnel_worker.c4
-rw-r--r--server/red_worker.c3
-rw-r--r--server/smartcard.c3
-rw-r--r--server/snd_worker.c3
6 files changed, 16 insertions, 2 deletions
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index ad247f47..e14e995a 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -502,6 +502,9 @@ static void inputs_connect(RedChannel *channel, RedClient *client,
stream,
num_common_caps, common_caps,
num_caps, caps);
+ if (!icc) {
+ return;
+ }
icc->motion_count = 0;
inputs_pipe_add_init(&icc->base);
}
diff --git a/server/main_channel.c b/server/main_channel.c
index 713f1214..ace24ff6 100644
--- a/server/main_channel.c
+++ b/server/main_channel.c
@@ -998,7 +998,7 @@ static MainChannelClient *main_channel_client_create(MainChannel *main_chan, Red
red_channel_client_create(sizeof(MainChannelClient), &main_chan->base,
client, stream, num_common_caps,
common_caps, num_caps, caps);
-
+ spice_assert(mcc != NULL);
mcc->connection_id = connection_id;
mcc->bitrate_per_sec = ~0;
#ifdef RED_STATISTICS
diff --git a/server/red_tunnel_worker.c b/server/red_tunnel_worker.c
index 384c36dd..12f31063 100644
--- a/server/red_tunnel_worker.c
+++ b/server/red_tunnel_worker.c
@@ -3452,7 +3452,9 @@ static void handle_tunnel_channel_link(RedChannel *channel, RedClient *client,
tcc = (TunnelChannelClient*)red_channel_client_create(sizeof(TunnelChannelClient),
channel, client, stream,
0, NULL, 0, NULL);
-
+ if (!tcc) {
+ return;
+ }
tcc->worker = worker;
tcc->worker->channel_client = tcc;
net_slirp_set_net_interface(&worker->tunnel_interface.base);
diff --git a/server/red_worker.c b/server/red_worker.c
index 3a0bdf4e..9e5624ba 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -9773,6 +9773,9 @@ static CommonChannelClient *common_channel_client_create(int size,
RedChannelClient *rcc =
red_channel_client_create(size, &common->base, client, stream,
num_common_caps, common_caps, num_caps, caps);
+ if (!rcc) {
+ return NULL;
+ }
CommonChannelClient *common_cc = (CommonChannelClient*)rcc;
common_cc->worker = common->worker;
common_cc->id = common->worker->id;
diff --git a/server/smartcard.c b/server/smartcard.c
index eb2823aa..8ded1421 100644
--- a/server/smartcard.c
+++ b/server/smartcard.c
@@ -500,6 +500,9 @@ static void smartcard_connect(RedChannel *channel, RedClient *client,
rcc = red_channel_client_create(sizeof(RedChannelClient), channel, client, stream,
num_common_caps, common_caps,
num_caps, caps);
+ if (!rcc) {
+ return;
+ }
red_channel_client_ack_zero_messages_window(rcc);
}
diff --git a/server/snd_worker.c b/server/snd_worker.c
index caffe672..3599c6ff 100644
--- a/server/snd_worker.c
+++ b/server/snd_worker.c
@@ -975,6 +975,9 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
client,
num_common_caps, common_caps,
num_caps, caps);
+ if (!channel->channel_client) {
+ goto error2;
+ }
return channel;
error2: