[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 08/12] vnc: remove a memory leak in zlib
From: |
Corentin Chary |
Subject: |
[Qemu-devel] [PATCH v3 08/12] vnc: remove a memory leak in zlib |
Date: |
Wed, 19 May 2010 09:24:08 +0200 |
Makes sure we free all ressources used in zlib encoding (zlib stream
and buffer).
Signed-off-by: Corentin Chary <address@hidden>
---
vnc-encoding-zlib.c | 8 ++++++++
vnc.c | 2 ++
vnc.h | 1 +
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/vnc-encoding-zlib.c b/vnc-encoding-zlib.c
index 52b18aa..1d4dd1a 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);
+}
diff --git a/vnc.c b/vnc.c
index 8f256b3..d622a5a 100644
--- a/vnc.c
+++ b/vnc.c
@@ -924,6 +924,8 @@ static void vnc_disconnect_finish(VncState *vs)
qobject_decref(vs->info);
+ vnc_zlib_clear(vs);
+
#ifdef CONFIG_VNC_TLS
vnc_tls_client_cleanup(vs);
#endif /* CONFIG_VNC_TLS */
diff --git a/vnc.h b/vnc.h
index abd9f27..ffcbc52 100644
--- a/vnc.h
+++ b/vnc.h
@@ -399,5 +399,6 @@ void vnc_hextile_send_framebuffer_update(VncState *vs, int
x,
void vnc_hextile_set_pixel_conversion(VncState *vs, int generic);
void vnc_zlib_send_framebuffer_update(VncState *vs, int x, int y, int w, int
h);
+void vnc_zlib_clear(VncState *vs);
#endif /* __QEMU_VNC_H */
--
1.7.0.2
- [Qemu-devel] [PATCH v3 00/12] *** SUBJECT HERE ***, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 01/12] Revert "vnc: set the right prefered encoding", Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 04/12] vnc: only use a single zlib stream, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 03/12] vnc: really call zlib if we want zlib, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 02/12] vnc: explain why set_encodings loop is reversed, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 05/12] vnc: adjust compression zstream level, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 08/12] vnc: remove a memory leak in zlib,
Corentin Chary <=
- [Qemu-devel] [PATCH v3 12/12] vnc: tight: add palette encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 07/12] vnc: add buffer_free(), Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 06/12] vnc: don't clear zlib stream on set_encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 10/12] vnc: add basic tight support, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 11/12] vnc: add support for tight fill encoding, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH v3 09/12] vnc: return the number of rectangles, Corentin Chary, 2010/05/19
- Re: [Qemu-devel] [PATCH v3 00/12] *** SUBJECT HERE ***, Corentin Chary, 2010/05/19
- [Qemu-devel] [PATCH 3/3] vnc: add missing target for vnc-encodings-*.o, Corentin Chary, 2010/05/27
- [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect, Corentin Chary, 2010/05/27