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)
commitedc9a8fcdb71f2b6b51b5d66e393cf895dbfe7ad
treed7ec043e791602bd3a065db190bf127f8ecfe8be
parent59b088f10d43de187f5f1ae4c5b8f29fff5ad3ad
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