summaryrefslogtreecommitdiffstats
path: root/server/red_dispatcher.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-03-11 12:13:33 +0100
committerAlexander Larsson <alexl@redhat.com>2010-03-11 12:14:08 +0100
commitd94cb8e1ba324ba5e534b6cddb604a58d7e15138 (patch)
tree0297b8b53fa7d778d6c4a89f2ef21cad1c226409 /server/red_dispatcher.c
parentaf4672326bdd88fbdbc4bd62a2a7563dc7d2077d (diff)
downloadspice-d94cb8e1ba324ba5e534b6cddb604a58d7e15138.tar.gz
spice-d94cb8e1ba324ba5e534b6cddb604a58d7e15138.tar.xz
spice-d94cb8e1ba324ba5e534b6cddb604a58d7e15138.zip
Use spice allocator in server/
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r--server/red_dispatcher.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
index 2eb510b7..17bf24cf 100644
--- a/server/red_dispatcher.c
+++ b/server/red_dispatcher.c
@@ -483,10 +483,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
red_error("socketpair failed %s", strerror(errno));
}
- if (!(dispatcher = malloc(sizeof(RedDispatcher)))) {
- red_error("malloc failed");
- }
- memset(dispatcher, 0, sizeof(RedDispatcher));
+ dispatcher = spice_new0(RedDispatcher, 1);
dispatcher->channel = channels[0];
init_data.qxl_interface = dispatcher->qxl_interface = qxl_interface;
init_data.id = qxl_interface->base.id;
@@ -540,10 +537,8 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
read_message(dispatcher->channel, &message);
ASSERT(message == RED_WORKER_MESSAGE_READY);
- if (!(reds_channel = malloc(sizeof(Channel)))) {
- red_error("reds channel malloc failed");
- }
- memset(reds_channel, 0, sizeof(Channel));
+
+ reds_channel = spice_new0(Channel, 1);
reds_channel->type = SPICE_CHANNEL_DISPLAY;
reds_channel->id = qxl_interface->base.id;
reds_channel->link = red_dispatcher_set_peer;
@@ -552,10 +547,7 @@ RedDispatcher *red_dispatcher_init(QXLInterface *qxl_interface)
reds_channel->data = dispatcher;
reds_register_channel(reds_channel);
- if (!(cursor_channel = malloc(sizeof(Channel)))) {
- red_error("reds channel malloc failed");
- }
- memset(cursor_channel, 0, sizeof(Channel));
+ cursor_channel = spice_new0(Channel, 1);
cursor_channel->type = SPICE_CHANNEL_CURSOR;
cursor_channel->id = qxl_interface->base.id;
cursor_channel->link = red_dispatcher_set_cursor_peer;