summaryrefslogtreecommitdiffstats
path: root/client_examples/SDLvncviewer.c
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2009-10-31 20:37:28 +0100
committerJohannes Schindelin <johannes.schindelin@gmx.de>2009-10-31 21:45:15 +0100
commit76b468ceb0737b8ea98a2ca076277d6fc6357aa0 (patch)
treed9c91f4e6b9750e7dafa41a44161cc5b1937b6b1 /client_examples/SDLvncviewer.c
parent7ed1c0aeac12fc7078013d0cb57ae40e6ee934d6 (diff)
downloadlibtdevnc-76b468ceb0737b8ea98a2ca076277d6fc6357aa0.tar.gz
libtdevnc-76b468ceb0737b8ea98a2ca076277d6fc6357aa0.zip
SDLvncviewer: don't call clean up the same client twice.
If rfbInitConnection fails, it cleans up the client, so protect against doing it ourselves again. Signed-off-by: Christian Beier <dontmind@freeshell.org> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'client_examples/SDLvncviewer.c')
-rw-r--r--client_examples/SDLvncviewer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/client_examples/SDLvncviewer.c b/client_examples/SDLvncviewer.c
index 5555cd1..f4e2cb6 100644
--- a/client_examples/SDLvncviewer.c
+++ b/client_examples/SDLvncviewer.c
@@ -356,7 +356,8 @@ static void cleanup(rfbClient* cl)
*/
SDL_QuitSubSystem(SDL_INIT_VIDEO);
SDL_InitSubSystem(SDL_INIT_VIDEO);
- rfbClientCleanup(cl);
+ if(cl)
+ rfbClientCleanup(cl);
}
@@ -513,6 +514,7 @@ int main(int argc,char** argv) {
cl->listenPort = LISTEN_PORT_OFFSET;
if(!rfbInitClient(cl,&argc,argv))
{
+ cl = NULL; /* rfbInitClient has already freed the client struct */
cleanup(cl);
break;
}