[Spice-devel] [PATCH 01/26] server/red_channel: protect red_channel_destroy from NULL peer

Alon Levy alevy at redhat.com
Fri Feb 11 09:48:46 PST 2011


happens in red_worker, since the destroy path there is different due
to (unneccessary?) ref counting on the channel.
---
 server/red_channel.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index dfba8b4..fc18b09 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -427,8 +427,10 @@ void red_channel_destroy(RedChannel *channel)
         return;
     }
     red_channel_pipe_clear(channel);
-    channel->core->watch_remove(channel->peer->watch);
-    channel->peer->cb_free(channel->peer);
+    if (channel->peer) {
+        channel->core->watch_remove(channel->peer->watch);
+        channel->peer->cb_free(channel->peer);
+    }
     spice_marshaller_destroy(channel->send_data.marshaller);
     free(channel);
 }
-- 
1.7.4



More information about the Spice-devel mailing list