[Spice-commits] server/dcc-encoders.c server/dcc-encoders.h server/red_worker.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Fri Nov 20 05:32:51 PST 2015


 server/dcc-encoders.c |   11 +++++++++++
 server/dcc-encoders.h |    1 +
 server/red_worker.c   |    1 +
 3 files changed, 13 insertions(+)

New commits:
commit 25203e9a6e0f35b89342747e759400d1ab6d3519
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Fri Nov 20 10:04:10 2015 +0100

    worker: Free encoders when client disconnects
    
    Signed-off-by: Pavel Grunt <pgrunt at redhat.com>

diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index e2e25e5..59b2c15 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -406,6 +406,17 @@ void dcc_encoders_init(DisplayChannelClient *dcc)
     dcc->zlib_level = ZLIB_DEFAULT_COMPRESSION_LEVEL;
 }
 
+void dcc_encoders_free(DisplayChannelClient *dcc)
+{
+    quic_destroy(dcc->quic);
+    lz_destroy(dcc->lz);
+    jpeg_encoder_destroy(dcc->jpeg);
+#ifdef USE_LZ4
+    lz4_encoder_destroy(dcc->lz4);
+#endif
+    zlib_encoder_destroy(dcc->zlib);
+}
+
 static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
 {
     compress_buf_free((RedCompressBuf *) opaque);
diff --git a/server/dcc-encoders.h b/server/dcc-encoders.h
index 5ae15ba..4530e19 100644
--- a/server/dcc-encoders.h
+++ b/server/dcc-encoders.h
@@ -36,6 +36,7 @@ typedef struct RedCompressBuf RedCompressBuf;
 typedef struct GlzDrawableInstanceItem GlzDrawableInstanceItem;
 
 void             dcc_encoders_init                           (DisplayChannelClient *dcc);
+void             dcc_encoders_free                           (DisplayChannelClient *dcc);
 void             dcc_free_glz_drawable_instance              (DisplayChannelClient *dcc,
                                                               GlzDrawableInstanceItem *item);
 void             dcc_free_glz_drawables_to_free              (DisplayChannelClient* dcc);
diff --git a/server/red_worker.c b/server/red_worker.c
index 6d974d6..4e342bd 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -4530,6 +4530,7 @@ static void display_channel_client_on_disconnect(RedChannelClient *rcc)
     free(dcc->send_data.stream_outbuf);
     free(dcc->send_data.free_list.res);
     dcc_destroy_stream_agents(dcc);
+    dcc_encoders_free(dcc);
 
     // this was the last channel client
     spice_debug("#draw=%d, #red_draw=%d, #glz_draw=%d",


More information about the Spice-commits mailing list