[Spice-devel] [PATCH 03/10] server/reds: fix possible segfault when accessing vdagent from reds_update_mouse_mode after vdagent set to NULL

Alon Levy alevy at redhat.com
Wed Jan 12 21:01:36 PST 2011


---
 server/reds.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/reds.c b/server/reds.c
index d325e20..7b4782c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -733,6 +733,8 @@ static void reds_agent_remove()
     SpiceCharDeviceInstance *sin = vdagent;
     SpiceCharDeviceInterface *sif;
 
+    ASSERT(reds->agent_state.connected)
+    reds->agent_state.connected = 0;
     vdagent = NULL;
     reds_update_mouse_mode();
 
@@ -740,9 +742,7 @@ static void reds_agent_remove()
         return;
     }
 
-    ASSERT(reds->agent_state.connected)
     sif = SPICE_CONTAINEROF(sin->base.sif, SpiceCharDeviceInterface, base);
-    reds->agent_state.connected = 0;
     if (sif->state) {
         sif->state(sin, reds->agent_state.connected);
     }
-- 
1.7.3.4



More information about the Spice-devel mailing list