[Spice-devel] [PATCH 09/18] Be consistent with opaque type

Frediano Ziglio fziglio at redhat.com
Mon Sep 26 08:12:42 UTC 2016


vdi_port_read_buf_release is registered passing data as
RedVDIReadBuf*, not RedPipeItem*. Cast opaque to proper
pointer type to avoid the assumption that first field of
RedVDIReadBuf is a RedPipeItem.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/reds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/reds.c b/server/reds.c
index 5463700..274c393 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -760,7 +760,8 @@ static void reds_agent_remove(RedsState *reds)
 
 static void vdi_port_read_buf_release(uint8_t *data, void *opaque)
 {
-    red_pipe_item_unref((RedPipeItem *)opaque);
+    RedVDIReadBuf *read_buf = (RedVDIReadBuf *)opaque;
+    red_pipe_item_unref(&read_buf->base);
 }
 
 /*
-- 
2.7.4



More information about the Spice-devel mailing list