diff options
author | Christian Beier <dontmind@freeshell.org> | 2011-03-17 13:11:59 +0100 |
---|---|---|
committer | Christian Beier <dontmind@freeshell.org> | 2011-03-17 13:11:59 +0100 |
commit | bf2470cec69ab00f7213aa136f5a2d486c9da17a (patch) | |
tree | 9ff1c77459eabd1ef1fc594c190cbb455c92a0bd /test/cursortest.c | |
parent | 6b60690a4a1642c77bd6ac42789c4da6ed770075 (diff) | |
download | libtdevnc-bf2470cec69ab00f7213aa136f5a2d486c9da17a.tar.gz libtdevnc-bf2470cec69ab00f7213aa136f5a2d486c9da17a.zip |
Check rfbGetScreen() return value everywhere.
This fixes a segfault when a server is invoked with the
'-help' commandline argument.
Diffstat (limited to 'test/cursortest.c')
-rw-r--r-- | test/cursortest.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/cursortest.c b/test/cursortest.c index 7a4efd3..78c37e3 100644 --- a/test/cursortest.c +++ b/test/cursortest.c @@ -322,8 +322,10 @@ static void doptr(int buttonMask,int x,int y,rfbClientPtr cl) int main(int argc,char** argv) { - rfbScreenInfoPtr rfbScreen = - rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + rfbScreenInfoPtr rfbScreen = rfbGetScreen(&argc,argv,maxx,maxy,8,3,bpp); + if(!rfbScreen) + return 0; + rfbScreen->desktopName = "Cursor Test"; rfbScreen->frameBuffer = (char*)malloc(maxx*maxy*bpp); rfbScreen->ptrAddEvent = doptr; |