From 76b468ceb0737b8ea98a2ca076277d6fc6357aa0 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Sat, 31 Oct 2009 20:37:28 +0100 Subject: [PATCH] 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 Signed-off-by: Johannes Schindelin --- client_examples/SDLvncviewer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; }