Re: [Spice-devel] [spice-gtk v2 1/2] spice-widget: fix leak of boxed type cursor-shape

2018-04-04 Thread Victor Toso
Hi,

On Wed, Apr 04, 2018 at 09:18:18AM -0400, Frediano Ziglio wrote:
> > From: Victor Toso 
> > 
> > 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 
> > ---
> >  src/spice-widget.c | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > 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", _shape, NULL);
> >  if (G_UNLIKELY(cursor_shape == NULL || cursor_shape->data == NULL)) {
> >  g_warn_if_reached();
> 
> OT: is this warning still worth?

I don't think so. It was introduced to warn that cursor was not
set in 13f5ebbf07a - IMHO, it is safe to remove.

Should the removal be in an extra patch or do you prefer it to be
included in this one?

> > +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,
> 
> Otherwise, for the series:
> 
> Acked-by: Frediano Ziglio 

Thanks again,
toso
> 
> Frediano


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [spice-gtk v2 1/2] spice-widget: fix leak of boxed type cursor-shape

2018-04-04 Thread Frediano Ziglio
> 
> From: Victor Toso 
> 
> 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 
> ---
>  src/spice-widget.c | 4 
>  1 file changed, 4 insertions(+)
> 
> 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", _shape, NULL);
>  if (G_UNLIKELY(cursor_shape == NULL || cursor_shape->data == NULL)) {
>  g_warn_if_reached();

OT: is this warning still worth?

> +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,

Otherwise, for the series:

Acked-by: Frediano Ziglio 

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel