vnc: rework VncState release workflow.
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 16 Jun 2009 12:19:48 +0000 (14:19 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Jun 2009 20:18:36 +0000 (15:18 -0500)
commit198a0039c5fca224a77e9761e2350dd9cc102ad0
treed7ec043e791602bd3a065db190bf127f8ecfe8be
parent11a1feb6552e3a4709e454faea5e3be5ca8d9e6a
vnc: rework VncState release workflow.

Split socket closing and releasing of VncState into two steps.  First
close the socket and set the variable to -1 to indicate shutdown in
progress.  Do the actual release in a few places where we can be sure it
doesn't cause trouble in form of use-after-free.  Add some checks for a
valid socket handle to make sure we don't try to use the closed socket.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
vnc.c