[PATCH 1/2 v2] dcc: free glz buffer after zlib compression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For zlib+glz compression image if first compressed with glz then the
resulting buffer is compressed again with zlib then the buffer from
zlib is returned to the caller.
However the temporary glz buffer was not freed resulting in a memory
leak.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/dcc.c | 7 +++++++
 1 file changed, 7 insertions(+)

Changes from v1:
- removed useless code.

diff --git a/server/dcc.c b/server/dcc.c
index 7c16fc0..7348627 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -708,6 +708,13 @@ int dcc_compress_image_glz(DisplayChannelClient *dcc,
             compress_buf_free(buf);
         }
         goto glz;
+    } else {
+        while (glz_data->data.bufs_head) {
+            RedCompressBuf *buf = glz_data->data.bufs_head;
+            glz_data->data.bufs_head = buf->send_next;
+            compress_buf_free(buf);
+        }
+        glz_data->data.bufs_tail = NULL;
     }
 
     dest->descriptor.type = SPICE_IMAGE_TYPE_ZLIB_GLZ_RGB;
-- 
2.4.3

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]