char-device: Avoid possible invalid function pointer cast

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@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2018-05-06 12:07:09 +01:00
parent ee3ca34722
commit c0f1c65b30

View File

@ -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