Re: [PATCH spice-server v2 05/23] stream: Use GLib memory functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2017-09-20 at 08:50 +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
> ---
>  server/dcc.c    | 2 +-
>  server/stream.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/server/dcc.c b/server/dcc.c
> index 3bf75a707..aa222b09a 100644
> --- a/server/dcc.c
> +++ b/server/dcc.c
> @@ -635,7 +635,7 @@ void dcc_stream_agent_clip(DisplayChannelClient*
> dcc, StreamAgent *agent)
>      item->clip_type = SPICE_CLIP_TYPE_RECTS;
>  
>      n_rects = pixman_region32_n_rects(&agent->clip);
> -    item->rects = spice_malloc_n_m(n_rects, sizeof(SpiceRect),
> sizeof(SpiceClipRects));
> +    item->rects = g_malloc(n_rects * sizeof(SpiceRect) +
> sizeof(SpiceClipRects));

Although it's equivalent, I'd prefer to place the parent struct first:

sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect)

Also below.

>      item->rects->num_rects = n_rects;
>      region_ret_rects(&agent->clip, item->rects->rects, n_rects);
>  
> diff --git a/server/stream.c b/server/stream.c
> index 71755ea1f..e674161a1 100644
> --- a/server/stream.c
> +++ b/server/stream.c
> @@ -169,7 +169,7 @@ static void red_stream_clip_item_free(RedPipeItem
> *base)
>      g_return_if_fail(item->base.refcount == 0);
>  
>      stream_agent_unref(display, item->stream_agent);
> -    free(item->rects);
> +    g_free(item->rects);
>      g_free(item);
>  }
>  
> @@ -777,7 +777,7 @@ static void red_upgrade_item_free(RedPipeItem
> *base)
>      g_return_if_fail(item->base.refcount == 0);
>  
>      drawable_unref(item->drawable);
> -    free(item->rects);
> +    g_free(item->rects);
>      g_free(item);
>  }
>  
> @@ -825,7 +825,7 @@ static void
> dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
>          upgrade_item->drawable = stream->current;
>          upgrade_item->drawable->refs++;
>          n_rects = pixman_region32_n_rects(&upgrade_item->drawable-
> >tree_item.base.rgn);
> -        upgrade_item->rects = spice_malloc_n_m(n_rects,
> sizeof(SpiceRect), sizeof(SpiceClipRects));
> +        upgrade_item->rects = g_malloc(n_rects * sizeof(SpiceRect) +
> sizeof(SpiceClipRects));

here

>          upgrade_item->rects->num_rects = n_rects;
>          region_ret_rects(&upgrade_item->drawable-
> >tree_item.base.rgn,
>                           upgrade_item->rects->rects, n_rects);


Acked-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx>

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]