From 195ed8cb365edeb0d0a70a2ffdeb7a073f9a8117 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Fri, 14 Feb 2020 17:17:10 +0000 Subject: qemu/queue.h: add QLIST_SAFE_REMOVE() QLIST_REMOVE() assumes the element is in a list. It also leaves the element's linked list pointers dangling. Introduce a safe version of QLIST_REMOVE() and convert open-coded instances of this pattern. Signed-off-by: Stefan Hajnoczi Reviewed-by: Sergio Lopez Message-id: 20200214171712.541358-4-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi --- chardev/spice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'chardev/spice.c') diff --git a/chardev/spice.c b/chardev/spice.c index 241e2b7770..bf7ea1e294 100644 --- a/chardev/spice.c +++ b/chardev/spice.c @@ -216,9 +216,7 @@ static void char_spice_finalize(Object *obj) vmc_unregister_interface(s); - if (s->next.le_prev) { - QLIST_REMOVE(s, next); - } + QLIST_SAFE_REMOVE(s, next); g_free((char *)s->sin.subtype); g_free((char *)s->sin.portname); -- cgit 1.4.1