summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}