[Spice-commits] 2 commits - src/spice-widget.c

Victor Toso de Carvalho victortoso at kemper.freedesktop.org
Wed Apr 4 15:15:43 UTC 2018


 src/spice-widget.c |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit a562aca77f6c7da753a299fd882411a41d37350f
Author: Victor Toso <me at victortoso.com>
Date:   Tue Apr 3 16:06:04 2018 +0200

    spice-widget: fix leak of boxed type cursor-shape
    
    No valgrind on this one but a leak similar to previous patch.
    This one was introduced in e691954be459087
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 7732f5f..8a6b5ab 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2992,6 +2992,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
 
         g_object_get(G_OBJECT(channel), "cursor", &cursor_shape, NULL);
         if (cursor_shape != NULL) {
+            g_boxed_free(SPICE_TYPE_CURSOR_SHAPE, cursor_shape);
             cursor_set(d->cursor, NULL, display);
         }
         return;
commit d567bfe65f010556f12c7ca5e95d0e480b2e4a70
Author: Victor Toso <me at victortoso.com>
Date:   Tue Apr 3 15:38:24 2018 +0200

    spice-widget: fix leak of boxed type cursor-shape
    
    Detected while testing valgrind on migration.
    
    > malloc (vg_replace_malloc.c:299)
    > g_malloc (in /usr/lib/libglib-2.0.so.0.5400.3)
    > spice_cursor_shape_copy (channel-cursor.c:99)
    > ??? (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > g_object_get_valist (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > g_object_get (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > cursor_set (spice-widget.c:2653)
    > g_closure_invoke (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > ??? (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > g_signal_emit_valist (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > g_signal_emit (in /usr/lib/libgobject-2.0.so.0.5400.3)
    > ??? (in /usr/lib/libgobject-2.0.so.0.5400.3)
    
    Signed-off-by: Victor Toso <victortoso at redhat.com>
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 1e7add4..7732f5f 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -2653,6 +2653,9 @@ static void cursor_set(SpiceCursorChannel *channel,
     g_object_get(G_OBJECT(channel), "cursor", &cursor_shape, NULL);
     if (G_UNLIKELY(cursor_shape == NULL || cursor_shape->data == NULL)) {
         g_warn_if_reached();
+        if (cursor_shape != NULL) {
+            g_boxed_free(SPICE_TYPE_CURSOR_SHAPE, cursor_shape);
+        }
         return;
     }
 
@@ -2667,6 +2670,7 @@ static void cursor_set(SpiceCursorChannel *channel,
                                                NULL, NULL);
     d->mouse_hotspot.x = cursor_shape->hot_spot_x;
     d->mouse_hotspot.y = cursor_shape->hot_spot_y;
+    g_boxed_free(SPICE_TYPE_CURSOR_SHAPE, cursor_shape);
     cursor = gdk_cursor_new_from_pixbuf(gtk_widget_get_display(GTK_WIDGET(display)),
                                         d->mouse_pixbuf,
                                         d->mouse_hotspot.x,


More information about the Spice-commits mailing list