summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2015-11-20 10:04:10 +0100
committerPavel Grunt <pgrunt@redhat.com>2015-11-20 14:30:55 +0100
commit25203e9a6e0f35b89342747e759400d1ab6d3519 (patch)
tree2abc8784296039be0b6908ba977d3811e3f916d0 /server
parent2c2e26579f7a47a6c92d18c756a9d45cd141eef8 (diff)
downloadspice-25203e9a6e0f35b89342747e759400d1ab6d3519.zip
spice-25203e9a6e0f35b89342747e759400d1ab6d3519.tar.gz
spice-25203e9a6e0f35b89342747e759400d1ab6d3519.tar.xz
worker: Free encoders when client disconnects
Signed-off-by: Pavel Grunt <pgrunt@redhat.com>
Diffstat (limited to 'server')
-rw-r--r--server/dcc-encoders.c11
-rw-r--r--server/dcc-encoders.h1
-rw-r--r--server/red_worker.c1
3 files changed, 13 insertions, 0 deletions
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",