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

Daniel P. Berrange berrange at redhat.com
Tue Jan 10 07:58:24 PST 2012


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



More information about the Spice-devel mailing list