aboutsummaryrefslogtreecommitdiff
path: root/vnc-encoding-zlib.c
diff options
context:
space:
mode:
authorCorentin Chary <corentincj@iksaif.net>2010-05-19 09:24:08 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2010-06-01 12:53:09 -0500
commit161c4f20bfbd54f0b77426adccb68ee831678af0 (patch)
treeb61ba391c826cee4811ddba94b415513dab9f1ec /vnc-encoding-zlib.c
parent5d418e3ba96cfa810e00885a52b55f19cac8f9a6 (diff)
vnc: remove a memory leak in zlib
Makes sure we free all ressources used in zlib encoding (zlib stream and buffer). Signed-off-by: Corentin Chary <corentincj@iksaif.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vnc-encoding-zlib.c')
-rw-r--r--vnc-encoding-zlib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/vnc-encoding-zlib.c b/vnc-encoding-zlib.c
index 52b18aa84a..1d4dd1aa47 100644
--- a/vnc-encoding-zlib.c
+++ b/vnc-encoding-zlib.c
@@ -140,3 +140,11 @@ void vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
vnc_write_u32(vs, bytes_written);
vs->output.offset = new_offset;
}
+
+void vnc_zlib_clear(VncState *vs)
+{
+ if (vs->zlib_stream.opaque) {
+ deflateEnd(&vs->zlib_stream);
+ }
+ buffer_free(&vs->zlib);
+}