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>
pull/1/head
Christian Beier 15 years ago committed by Johannes Schindelin
parent 7ed1c0aeac
commit 76b468ceb0

@ -356,7 +356,8 @@ static void cleanup(rfbClient* cl)
*/ */
SDL_QuitSubSystem(SDL_INIT_VIDEO); SDL_QuitSubSystem(SDL_INIT_VIDEO);
SDL_InitSubSystem(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; cl->listenPort = LISTEN_PORT_OFFSET;
if(!rfbInitClient(cl,&argc,argv)) if(!rfbInitClient(cl,&argc,argv))
{ {
cl = NULL; /* rfbInitClient has already freed the client struct */
cleanup(cl); cleanup(cl);
break; break;
} }

Loading…
Cancel
Save