[PATCH spice-server 3/3] char-device: Avoid possible invalid function pointer cast

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

 



This is reported by GCC 8.0.1 (Fedora 28).
Instead of doing a possible invalid cast destroy and create the
queue again.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/char-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/char-device.c b/server/char-device.c
index 242d8782..aef6e887 100644
--- a/server/char-device.c
+++ b/server/char-device.c
@@ -835,8 +835,8 @@ void red_char_device_reset(RedCharDevice *dev)
 
         spice_debug("send_queue_empty %d", g_queue_is_empty(dev_client->send_queue));
         dev_client->num_send_tokens += g_queue_get_length(dev_client->send_queue);
-        g_queue_foreach(dev_client->send_queue, (GFunc)red_pipe_item_unref, NULL);
-        g_queue_clear(dev_client->send_queue);
+        g_queue_free_full(dev_client->send_queue, (GDestroyNotify)red_pipe_item_unref);
+        dev_client->send_queue = g_queue_new();
 
         /* If device is reset, we must reset the tokens counters as well as we
          * don't hold any data from client and upon agent's reconnection we send
-- 
2.17.0

_______________________________________________
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]