Commit 76b468ce authored by Christian Beier's avatar Christian Beier Committed by Johannes Schindelin

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: 's avatarChristian Beier <dontmind@freeshell.org>
Signed-off-by: 's avatarJohannes Schindelin <johannes.schindelin@gmx.de>
parent 7ed1c0ae
...@@ -356,7 +356,8 @@ static void cleanup(rfbClient* cl) ...@@ -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) { ...@@ -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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment