[Spice-devel] [PATCH 03/17] Rewrite code to avoid triggering warning about casting param to free()

Alon Levy alevy at redhat.com
Thu Jan 12 03:30:24 PST 2012


On Tue, Jan 10, 2012 at 03:58:24PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Since free() takes a void* parameters do not need to be cast.
> 
> The existing code here is actally fine, but it trips up the
> syntax-check rule, so tweak it to an equivalent construct
> which passes the syntax check
> ---
>  server/smartcard.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/server/smartcard.c b/server/smartcard.c
> index f9cafdf..809eca0 100644
> --- a/server/smartcard.c
> +++ b/server/smartcard.c
> @@ -332,7 +332,8 @@ static void smartcard_channel_release_pipe_item(RedChannelClient *rcc,
>                                        PipeItem *item, int item_pushed)
>  {
>      if (item->type == PIPE_ITEM_TYPE_MSG) {
> -        free(((MsgItem*)item)->vheader);
> +        MsgItem *mi = (MsgItem *)item;
> +        free(mi->vheader);
>      }
>      free(item);
>  }
> -- 
> 1.7.7.5
> 

ACK.

> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list