summaryrefslogtreecommitdiff
path: root/vnc.c
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2009-10-01 20:53:12 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 14:01:16 -0500
commit6c098407ef2c56cf6b42d6e3b545b26eaaff2edf (patch)
treecb49ed6a6f3b4b938130d090558be5af10f4f9f5 /vnc.c
parentx86: fix miss merge (diff)
downloadqemu-kvm-6c098407ef2c56cf6b42d6e3b545b26eaaff2edf.tar.gz
qemu-kvm-6c098407ef2c56cf6b42d6e3b545b26eaaff2edf.tar.bz2
qemu-kvm-6c098407ef2c56cf6b42d6e3b545b26eaaff2edf.zip
Win32: Fix vnc support.
Without this patch, qemu on windows crashes as soon as a vnc client connects. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vnc.c')
-rw-r--r--vnc.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/vnc.c b/vnc.c
index 42c92ed36..01e8e9348 100644
--- a/vnc.c
+++ b/vnc.c
@@ -538,6 +538,25 @@ static void send_framebuffer_update_hextile(VncState *vs, int x, int y, int w, i
}
+#define ZALLOC_ALIGNMENT 16
+
+static void *zalloc(void *x, unsigned items, unsigned size)
+{
+ void *p;
+
+ size *= items;
+ size = (size + ZALLOC_ALIGNMENT - 1) & ~(ZALLOC_ALIGNMENT - 1);
+
+ p = qemu_mallocz(size);
+
+ return (p);
+}
+
+static void zfree(void *x, void *addr)
+{
+ qemu_free(addr);
+}
+
static void vnc_zlib_init(VncState *vs)
{
int i;
@@ -572,8 +591,8 @@ static int vnc_zlib_stop(VncState *vs, int stream_id)
VNC_DEBUG("VNC: initializing zlib stream %d\n", stream_id);
VNC_DEBUG("VNC: opaque = %p | vs = %p\n", zstream->opaque, vs);
- zstream->zalloc = Z_NULL;
- zstream->zfree = Z_NULL;
+ zstream->zalloc = zalloc;
+ zstream->zfree = zfree;
err = deflateInit2(zstream, vs->tight_compression, Z_DEFLATED, MAX_WBITS,
MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);