[Spice-devel] [PATCH spice-gtk] Clear cache and glz dictionnary on switch-host

Marc-André Lureau marcandre.lureau at gmail.com
Sun Apr 15 13:01:58 PDT 2012


If we don't clear the glz dictionnary, this might lead to
corrupted/invalid dictionnary and invalid memory allocation due
unbounded increase of dictionnary size
---
 gtk/spice-session.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gtk/spice-session.c b/gtk/spice-session.c
index d30d089..02b35f3 100644
--- a/gtk/spice-session.c
+++ b/gtk/spice-session.c
@@ -1122,9 +1122,9 @@ gboolean spice_session_get_client_provided_socket(SpiceSession *session)
 }
 
 G_GNUC_INTERNAL
-void spice_session_switching_disconnect(SpiceSession *session)
+void spice_session_switching_disconnect(SpiceSession *self)
 {
-    SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(session);
+    SpiceSessionPrivate *s = SPICE_SESSION_GET_PRIVATE(self);
     struct channel *item;
     RingItem *ring, *next;
 
@@ -1141,6 +1141,10 @@ void spice_session_switching_disconnect(SpiceSession *session)
     }
 
     g_warn_if_fail(!ring_is_empty(&s->channels)); /* ring_get_length() == 1 */
+
+    spice_session_palettes_clear(self);
+    spice_session_images_clear(self);
+    glz_decoder_window_clear(s->glz_window);
 }
 
 G_GNUC_INTERNAL
-- 
1.7.10



More information about the Spice-devel mailing list